:root {
  color-scheme: light;
  --pli-primary: #004B97;
  --pli-secondary: #3165AF;
  --pli-accent: #739DD3;
  --pli-text: #333333;
  --pli-white: #FFFFFF;
  --pli-bg: #F6F9FD;
  --pli-bg-soft: #EDF4FB;
  --pli-line: #CAD9EA;
  --pli-line-strong: #A9C0DC;
  --pli-hover: #E8F1FB;
  --bg: var(--pli-bg);
  --ink: var(--pli-text);
  --muted: var(--pli-secondary);
  --line: var(--pli-line);
  --panel: var(--pli-white);
  --accent: var(--pli-primary);
  --accent-2: var(--pli-secondary);
  --danger: #b42318;
  --soft: var(--pli-bg-soft);
  --shadow: none;
  font-family: "Avenir Next LT Pro Light", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: block;
  overflow-x: hidden;
}
.standalone-page {
  display: block;
  overflow-x: hidden;
}
.role-layout {
  display: block;
  overflow-x: hidden;
}
.role-layout .project-shell {
  margin-left: 260px;
  width: calc(100% - 260px);
  max-width: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  height: 100vh;
  padding: 24px 18px;
  background: #173f39;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand small, .session small { color: rgba(255,255,255,.7); display: block; margin-top: 2px; }
.mark {
  width: 44px; height: 44px; border-radius: 8px;
  background: #f3c55f; color: #173f39;
  display: grid; place-items: center; font-weight: 800;
}
.mark img {
  display: block;
  width: 78%;
  height: 78%;
  object-fit: contain;
}
nav { display: grid; gap: 8px; }
.nav, button {
  border: 0; border-radius: 8px; padding: 11px 13px;
  font-weight: 700; cursor: pointer;
}
.nav {
  text-align: left; background: transparent; color: rgba(255,255,255,.78);
  text-decoration: none;
}
.nav-icon { display: inline-block; width: 18px; text-align: center; margin-right: 4px; }
.nav.active, .nav:hover { background: rgba(255,255,255,.12); color: white; }
.session { margin-top: auto; display: grid; gap: 10px; }

.lobby-page {
  min-height: 100vh;
  width: 100vw;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(20,108,95,.08), rgba(27,77,137,.06)),
    var(--bg);
}
.lobby-shell {
  position: fixed;
  inset: 0;
  min-height: 100vh;
  width: 100vw;
  max-width: 100vw;
  overflow: hidden;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
}
.lobby-hero {
  display: grid;
  align-content: center;
  justify-self: center;
  width: min(58ch, calc(100% - 96px));
  min-height: 100vh;
  gap: 36px;
}
.lobby-brand {
  color: var(--ink);
}
.lobby-brand small {
  color: var(--muted);
}
.lobby-hero h1 {
  max-width: 12.5em;
  font-size: clamp(38px, 3.15vw, 56px);
  line-height: 1.08;
}
.lobby-card {
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: clamp(54px, 8vh, 110px) clamp(56px, 7vw, 132px);
  grid-template-columns: 1fr;
  gap: 24px;
  align-content: center;
  border-radius: 0;
  border-width: 0 0 0 1px;
  box-shadow: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.44), rgba(255,253,248,.82)),
    var(--panel);
}
.lobby-card h1 {
  font-size: clamp(34px, 2.35vw, 48px);
}
.lobby-card form {
  grid-template-columns: 1fr;
}
.credential-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0;
}
.credential-grid button {
  min-height: 42px;
  padding: 10px;
  color: var(--accent-2);
  background: #eef4fb;
  border: 1px solid #c8d8ea;
}

.shell { padding: 28px; min-width: 0; margin-left: 260px; }
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  width: 100%;
}
/* En la vista Mensajes el chat tiene su propio header → ocultamos el topbar */
.topbar-hidden {
  display: none !important;
}
h1, h2, p { margin-top: 0; }
h1 { font-size: 30px; margin-bottom: 3px; }
h1 { overflow-wrap: anywhere; }
h2 { font-size: 17px; margin-bottom: 16px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 800; margin-bottom: 6px; }
.muted { color: var(--muted); line-height: 1.55; }
.hidden { display: none !important; }
.view { display: none; }
.view.active { display: block; }

.login-card {
  max-width: 880px; margin: 8vh auto 0; padding: 34px;
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 34px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
}
.login-card.lobby-card {
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: clamp(54px, 8vh, 110px) clamp(56px, 7vw, 132px);
  grid-template-columns: 1fr;
  gap: 24px;
  align-content: center;
  border-radius: 0;
  border-width: 0 0 0 1px;
  box-shadow: none;
}
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: 0 10px 30px rgba(31,41,51,.06);
  overflow-x: auto;
}
.stack { display: grid; gap: 13px; }
.form-narrow { max-width: 760px; }
.grid-form { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 18px; align-items: start; margin-bottom: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
label { display: grid; gap: 6px; color: #344054; font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 7px;
  padding: 10px 11px; background: white; color: var(--ink); font: inherit;
}
input.is-invalid, select.is-invalid, textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}
.form-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}
.form-hint[data-kind="error"] { color: var(--danger); }
.form-hint[data-kind="ok"] { color: var(--accent); }
.user-code-field {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}
.project-work-field {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}
.project-work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px;
}
.user-code-grid {
  display: grid;
  grid-template-columns: minmax(86px, .75fr) minmax(76px, .65fr) minmax(110px, 1fr);
  gap: 8px;
}
.area-picker {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.area-picker legend {
  padding: 0 6px;
  color: var(--ink);
  font-weight: 850;
}
.area-picker.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .12);
}
.area-option {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  font-weight: 850;
}
.area-option input,
.area-option-card input {
  width: auto;
  margin-top: 3px;
}
.area-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.area-option-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  min-height: 64px;
  padding: 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
}
.area-option-card.selected {
  border-color: #0f766e;
  background: #eef7f4;
}
.area-option-card span {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.area-option-card strong,
.area-option-card small {
  overflow-wrap: anywhere;
}
.area-option-card small {
  color: var(--muted);
  font-weight: 800;
}
.project-code-grid {
  display: grid;
  grid-template-columns: minmax(74px, .44fr) minmax(96px, .5fr) minmax(116px, .58fr) minmax(88px, .42fr) minmax(106px, .48fr) minmax(90px, .42fr);
  gap: 8px;
}
.user-code-grid label {
  gap: 4px;
}
.project-code-grid label {
  gap: 4px;
}
.user-code-grid label small {
  color: var(--muted);
  font-size: 11px;
}
.project-code-grid label small {
  color: var(--muted);
  font-size: 11px;
}
.user-code-grid input[readonly],
.project-code-grid input[readonly] {
  background: #f2f4f7;
  color: #475467;
  font-weight: 850;
}
.smart-user-picker {
  display: grid;
  gap: 10px;
}
.smart-user-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.selected-user-chip {
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid #b7e4d5;
  border-radius: 999px;
  background: #ecfdf7;
  color: #075e54;
  font-size: 12px;
  font-weight: 850;
  overflow-wrap: anywhere;
}
.smart-user-results {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 2px 2px 4px;
}
.team-user-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, auto) minmax(120px, auto);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid #d9dfe7;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}
.team-user-result:hover,
.team-user-result.is-selected {
  border-color: #0f6f64;
  background: #f1fbf7;
}
.team-user-result small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}
.team-picker-table {
  min-width: 760px;
}
.team-picker-row {
  grid-template-columns: minmax(190px, 1.15fr) minmax(120px, .56fr) minmax(240px, 1.2fr) minmax(150px, .7fr);
  align-items: start;
}
.team-picker-row > * {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}
.team-picker-table .team-user-result {
  width: 100%;
  border-radius: 0;
}
.team-picker-table .team-user-result.is-selected {
  background: var(--pli-hover);
  border-color: var(--pli-secondary);
}
textarea { resize: vertical; }
button { background: var(--accent); color: white; }
button.secondary { background: var(--accent-2); }
button.ghost { background: rgba(255,255,255,.1); color: white; }
button.danger { background: var(--danger); }
button.small { padding: 7px 9px; font-size: 12px; }
.icon-button {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
}
.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-button.is-refreshing svg,
#refreshBtn.is-refreshing svg {
  animation: refresh-spin .75s ease-in-out;
}
@keyframes refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.notification-button {
  background: var(--accent-2);
}
.notification-button.has-unread {
  background: var(--accent);
}
.notification-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid var(--bg);
  background: #d92d20;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
}
.button-link {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; padding: 8px 10px; font-weight: 800;
  background: var(--accent-2); color: white; text-decoration: none; font-size: 12px;
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.panel-heading h2, .panel-heading p { margin-bottom: 0; }
.canonical-line { margin: 0 0 12px; color: var(--accent); font-weight: 800; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metrics article {
  padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
.metrics span { display: block; font-size: 32px; font-weight: 850; color: var(--accent); }
.metrics small { color: var(--muted); font-weight: 700; }
.context-rail {
  display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 10px; margin-bottom: 18px;
}
.context-rail article {
  display: grid; gap: 3px; padding: 12px 14px; background: #eef4ff; border: 1px solid #c7d7fe; border-radius: 8px;
}
.context-rail strong { font-size: 22px; color: var(--accent-2); }
.context-rail small { color: #344054; font-weight: 750; }
.overview-heading {
  margin: 4px 0 12px;
}
.project-dashboard {
  display: grid;
  gap: 14px;
}
.project-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}
.project-card {
  display: grid;
  gap: 12px;
  min-height: 260px;
  padding: 18px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(31,41,51,.08);
  text-align: left;
}
.project-card:hover {
  border-color: #93b7d5;
  background: #fbfdff;
  transform: translateY(-1px);
}
.project-card > strong {
  display: block;
  min-height: 46px;
  font-size: 19px;
  line-height: 1.22;
}
.project-card-topline,
.project-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.project-card-topline small,
.project-card-footer small {
  color: var(--muted);
  font-weight: 800;
}
.project-card-phase {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid #d0dce3;
  border-radius: 7px;
  background: #f8fafc;
  color: #344054;
  font-weight: 800;
}
.project-card-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.project-card-metrics span {
  min-height: 70px;
  padding: 10px;
  display: grid;
  gap: 2px;
  align-content: center;
  border: 1px solid #d9e6df;
  border-radius: 7px;
  background: #eef7f4;
}
.project-card-metrics b {
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
}
.project-card-metrics small {
  color: #475467;
  font-size: 11px;
  font-weight: 850;
}
.toolbar {
  display: grid; grid-template-columns: minmax(220px, 1fr) 170px 230px; gap: 10px; margin-bottom: 12px;
}
.assets-toolbar { grid-template-columns: minmax(260px, 1fr) minmax(220px, .8fr) minmax(180px, .7fr) minmax(180px, .7fr); }
.compact-toolbar { grid-template-columns: minmax(260px, 1fr) minmax(260px, .75fr); }

.table { display: grid; gap: 8px; }
.row {
  display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 12px; align-items: center;
  padding: 12px; background: white; border: 1px solid #e8e2d7; border-radius: 8px;
}
.row > *,
.sheet-row > *,
td,
th {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}
.row.wide { grid-template-columns: 1.4fr 1fr 1fr 1fr auto; }
.row strong { display: block; }
.row small { color: var(--muted); }
.sheet-row {
  display: grid; gap: 10px; align-items: center;
  min-height: 46px; width: 100%; padding: 9px 10px;
  background: #fff; border: 1px solid #e8e2d7; border-radius: 6px;
  color: var(--ink); text-align: left;
}
.role-five { grid-template-columns: minmax(210px, auto) minmax(310px, 1.4fr) minmax(180px, .8fr) minmax(190px, .85fr) minmax(150px, .65fr); }
.role-four { grid-template-columns: minmax(310px, 1.35fr) minmax(230px, 1fr) minmax(160px, .7fr) minmax(150px, .65fr); }
.matrix-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 8px;
  max-width: 100%;
  overscroll-behavior-x: contain;
}
.matrix-table {
  min-width: 1180px;
}
.matrix-table .sheet-row {
  gap: 0;
  border-radius: 0;
  border-left: 1px solid #d9dfe7;
  border-right: 1px solid #d9dfe7;
}
.matrix-table .sheet-row:not(.sheet-head):nth-child(odd) {
  background: #fbfcfe;
}
.matrix-table .sheet-row:not(.sheet-head):nth-child(even) {
  background: #fffaf1;
}
.matrix-table .sheet-row > * {
  min-height: 100%;
  padding: 0 10px;
  border-right: 1px solid #d9dfe7;
}
.matrix-table .sheet-row > *:first-child {
  padding-left: 0;
}
.matrix-table .sheet-row > *:last-child {
  border-right: 0;
}
.matrix-table .table-actions-cell {
  position: sticky;
  left: 0;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  z-index: 5;
  align-self: stretch;
  box-shadow: 1px 0 0 var(--pli-line);
}
.matrix-table .sheet-head .table-actions-cell,
.matrix-table .table-actions-head {
  z-index: 7;
  background: var(--pli-primary);
}
.matrix-table .sheet-row:not(.sheet-head):nth-child(odd) > .table-actions-cell {
  background: #F8FBFF;
}
.matrix-table .sheet-row:not(.sheet-head):nth-child(even) > .table-actions-cell {
  background: var(--pli-white);
}
.matrix-table .table-actions-cell.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-content: center;
  align-items: stretch;
  justify-content: stretch;
  padding: 10px !important;
}
.matrix-table .table-actions-cell.actions .button-link,
.matrix-table .table-actions-cell.actions button {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  height: 42px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
  text-align: center;
  font-size: 12px;
}
.matrix-table .table-actions-cell.actions .button-link:only-child,
.matrix-table .table-actions-cell.actions button:only-child {
  grid-column: 1 / -1;
}
.sheet-row strong { display: block; line-height: 1.25; }
.sheet-row small { display: block; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.date-cell {
  display: grid;
  gap: 3px;
  align-content: center;
  line-height: 1.1;
}
.date-cell strong {
  font-size: 13px;
  line-height: 1.15;
  font-weight: 800;
}
.date-cell small {
  margin-top: 0;
  font-size: 12px;
  color: var(--muted);
}
.sheet-head {
  min-height: 34px; background: #f2f4f7; color: #475467;
  font-size: 12px; font-weight: 850; text-transform: uppercase;
}
.table-pref-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 10px;
}
.table-pref-bar > small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding-top: 9px;
}
.table-pref-menu {
  position: relative;
  min-width: 150px;
}
.table-pref-menu summary {
  min-height: 38px;
  padding: 9px 14px;
  display: inline-grid;
  align-items: center;
  border: 1px solid #0f6f64;
  border-radius: 7px;
  background: #ecfdf7;
  color: #075e54;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
  box-shadow: 0 1px 0 rgba(15, 111, 100, .16);
}
.table-pref-menu summary:hover {
  border-color: #0b5f55;
  background: #dff8f0;
}
.table-pref-menu summary::-webkit-details-marker { display: none; }
.table-pref-panel {
  position: absolute;
  z-index: 12;
  width: min(290px, calc(100vw - 48px));
  margin-top: 8px;
  padding: 12px;
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}
.table-pref-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
}
.table-pref-check input {
  width: auto;
}
.table-col-hidden {
  display: none !important;
}
.table-resizable-head {
  position: relative;
  padding-right: 16px !important;
}
.table-resize-handle {
  position: absolute;
  top: 4px;
  right: -5px;
  bottom: 4px;
  width: 10px;
  cursor: col-resize;
  touch-action: none;
  z-index: 3;
}
.table-resize-handle::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  width: 2px;
  border-radius: 999px;
  background: #b6c2d1;
}
.table-resize-handle:hover::after,
.is-resizing-table .table-resize-handle::after {
  background: var(--accent-2);
}
.is-resizing-table {
  cursor: col-resize;
  user-select: none;
}
.as-row {
  font: inherit; cursor: pointer;
}
.as-row:hover { border-color: #9bb9d9; background: #f8fbff; }
.users-sheet { grid-template-columns: minmax(260px, 1.35fr) 140px minmax(220px, 1fr) minmax(160px, .75fr) 110px minmax(230px, 1fr); }
.projects-sheet { grid-template-columns: minmax(300px, 1.35fr) 150px minmax(180px, .85fr) 120px 150px 110px minmax(190px, .9fr); }
.role-projects { grid-template-columns: minmax(300px, 1.35fr) 145px minmax(190px, .9fr) 120px 150px; }
.project-row-link {
  width: 100%;
  cursor: pointer;
}
.project-row-link:hover {
  border-color: #9bb9d9;
  background: #f8fbff !important;
}
.assets-sheet { grid-template-columns: 190px minmax(310px, 1.45fr) minmax(260px, 1fr) minmax(210px, .85fr) minmax(210px, .85fr) 120px 96px minmax(210px, .85fr); }
.versions-sheet { grid-template-columns: minmax(240px, 1.5fr) 120px minmax(150px, 1fr) 160px 170px; }
.review-sheet { grid-template-columns: 140px minmax(330px, 1.35fr) minmax(250px, 1fr) 150px minmax(210px, .85fr) minmax(170px, .9fr) 120px; }
.bitacora-sheet { grid-template-columns: minmax(150px, .9fr) minmax(200px, 1.2fr) minmax(180px, 1fr) minmax(150px, .9fr) 90px minmax(180px, 1fr); }
.inspector {
  margin-top: 14px; padding: 14px; border: 1px solid #d0d5dd; border-radius: 8px; background: #f8fafc;
}
.inspector-grid { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.detail-grid article,
.subpanel {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
}
.user-profile-card {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #bed5cc;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(237, 247, 244, .92), rgba(250, 252, 252, .98));
}
.user-profile-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.user-profile-head h3 {
  margin: 0 0 3px;
  font-size: 24px;
  line-height: 1.12;
}
.user-key-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 8px;
}
.user-key-grid article {
  padding: 10px 11px;
  background: rgba(255,255,255,.78);
  border: 1px solid #d0dce3;
  border-radius: 7px;
}
.user-key-grid small,
.user-profile-head small {
  display: block;
  color: var(--muted);
  font-weight: 850;
  margin-bottom: 3px;
}
.user-key-grid strong {
  display: block;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.drawer-actions-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 16px;
}
.user-detail-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
  align-items: center;
  justify-content: start;
  gap: 10px;
  margin: 0 0 18px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
}
.user-detail-actions button {
  width: 150px;
  min-height: 42px;
  padding: 0 12px;
  white-space: nowrap;
}
.drawer-head-actions #drawerActionButtons:empty {
  display: none;
}
.drawer-action-buttons {
  display: contents;
}
.edit-shell {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fffaf1;
}
.detail-grid small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 4px;
}
.drawer-columns { margin-bottom: 18px; }
.user-relations-readonly .subpanel-title {
  margin-bottom: 8px;
}
.subpanel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.subpanel h3,
.stack h3 {
  margin: 0 0 12px;
  font-size: 15px;
}
.subpanel-title h3 {
  margin-bottom: 0;
}
.inline-assign-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d0d5dd;
}
.badge {
  display: inline-flex; align-items: center; width: fit-content;
  border-radius: 999px; padding: 4px 8px; background: var(--soft); color: var(--accent); font-size: 12px; font-weight: 800;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 850;
}
.status-active { background: #dcfce7; color: #166534; }
.status-inactive { background: #fee2e2; color: #991b1b; }
.status-neutral { background: #e7f4f1; color: #006b5f; }
.status-pending { background: #eef4fb; color: var(--accent-2); }
.status-warning { background: #fff7dc; color: #8a5a00; }
.role-pill {
  max-width: 100%;
  min-height: 26px;
  padding: 4px 9px;
  background: #e7f4f1;
  color: #006b5f;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inline-check {
  grid-template-columns: 18px 1fr;
  align-items: center;
}
.inline-check input { width: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.top-actions {
  align-items: center;
  justify-content: flex-end;
  margin-top: 0;
  margin-left: auto;
  gap: 10px;
}
.top-actions button {
  white-space: nowrap;
}
.audit-table {
  gap: 4px;
}
.audit-row {
  min-height: 30px;
  padding: 5px 8px;
  gap: 8px;
  border-radius: 5px;
  font-size: 12px;
  grid-template-columns: minmax(320px, 1.45fr) minmax(180px, .8fr) minmax(110px, .55fr) minmax(180px, .8fr) minmax(120px, .6fr);
}
.audit-head {
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 11px;
  grid-template-columns: minmax(320px, 1.45fr) minmax(180px, .8fr) minmax(110px, .55fr) minmax(180px, .8fr) minmax(120px, .6fr);
}
.audit-row strong {
  display: inline;
  font-size: 12px;
}
.audit-row small {
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
}
.audit-row span {
  line-height: 1.2;
}
.json-block {
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid #d0d5dd;
  border-radius: 7px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.operator-notes {
  padding: 14px;
  border: 1px solid #bed5cc;
  border-radius: 8px;
  background: #eef7f4;
}
.operator-notes textarea {
  min-height: 160px;
  font-size: 15px;
  line-height: 1.55;
}
.toast {
  position: fixed; right: 22px; bottom: 22px; max-width: 420px;
  padding: 13px 15px; border-radius: 8px; background: #111827; color: white; box-shadow: var(--shadow);
}
.project-shell { grid-column: 1 / -1; padding: 28px; max-width: 1560px; width: 100%; margin: 0 auto; }
.project-header {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; margin-bottom: 22px;
}
.project-header > div { min-width: 0; }
.project-header .actions {
  max-width: none;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.return-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}
.return-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.project-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.project-side-tabs {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 10px 30px rgba(31,41,51,.06);
}
.project-tab-button {
  width: 100%;
  min-height: 58px;
  padding: 10px 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid #d0d5dd;
  text-align: left;
}
.project-tab-button.active,
.project-tab-button:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.project-tab-button small {
  min-width: 28px;
  min-height: 28px;
  padding: 4px 7px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e7eef8;
  color: var(--accent-2);
  font-weight: 900;
}
.project-tab-button.active small,
.project-tab-button:hover small {
  background: rgba(255,255,255,.18);
  color: #fff;
}
.project-tab-content {
  min-width: 0;
}
.project-tab-panel {
  display: none;
}
.project-tab-panel.active {
  display: block;
}
.project-file-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(170px, .55fr) minmax(170px, .55fr) auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
}
.column-chooser {
  position: relative;
  min-width: 160px;
}
.column-chooser summary {
  min-height: 42px;
  padding: 10px 12px;
  display: grid;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #344054;
  font-weight: 800;
  cursor: pointer;
}
.column-grid {
  position: absolute;
  right: 0;
  z-index: 5;
  width: 230px;
  margin-top: 8px;
  padding: 12px;
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}
.column-grid label {
  font-size: 12px;
}
.locked-column {
  color: var(--muted);
}
.project-files-table {
  min-width: 940px;
}
.project-files-sheet {
  min-width: 920px;
  gap: 6px;
}
.project-files-table .sheet-row > * {
  padding: 0 6px;
}
.project-files-table .sheet-head > * {
  overflow-wrap: normal;
}
.pulse-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; align-items: start; }
.review-layout { grid-template-columns: minmax(0, 1.75fr) minmax(360px, .75fr); }
.pulse-section { display: grid; gap: 18px; }
.status-line { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pdf-preview {
  width: 100%;
  height: min(72vh, 820px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.pdf-frame {
  width: 100%;
  height: min(74vh, 860px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.pdf-text-fallback {
  margin-top: 12px;
}
.pdf-text-fallback summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--accent-2);
  margin-bottom: 10px;
}
.document-preview {
  min-height: min(72vh, 820px);
  max-height: min(72vh, 820px);
  overflow: auto;
}
.preview-expanded .project-shell {
  max-width: none;
  padding: 16px;
}
.preview-expanded .pulse-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
}
.preview-expanded .document-preview,
.preview-expanded .pdf-preview {
  height: calc(100vh - 190px);
  max-height: none;
}
.image-preview {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.image-preview img { max-width: 100%; height: auto; }
.spreadsheet-preview,
.docx-preview,
.dxf-preview,
.pdf-page-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}
.sheet-preview { margin-bottom: 18px; }
.sheet-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}
.sheet-title small {
  color: #475467;
  font-weight: 750;
}
.sheet-preview h3,
.docx-preview h3 {
  margin: 0;
  font-size: 16px;
}
.sheet-scroll {
  overflow: auto;
  border: 1px solid #e8e2d7;
  border-radius: 6px;
}
table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  background: white;
  font-size: 13px;
}
th, td {
  border: 1px solid #e8e2d7;
  padding: 8px 10px;
  min-width: 120px;
  text-align: left;
  vertical-align: top;
}
th {
  position: sticky;
  top: 0;
  background: #f2f4f7;
  color: #344054;
  z-index: 1;
}
.excel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid #d9e2ef;
}
.excel-tabs span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #d9e2ef;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #eef5fb;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 850;
}
.excel-tabs span.is-active {
  background: #fff;
  color: var(--accent);
}
.excel-grid-wrap {
  max-height: 58vh;
  background:
    linear-gradient(90deg, rgba(255,255,255,.92), rgba(255,255,255,0)) 0 0 / 22px 100% no-repeat,
    #fff;
}
.excel-grid {
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  table-layout: fixed;
}
.excel-grid th,
.excel-grid td {
  min-width: 136px;
  max-width: 260px;
  padding: 7px 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.excel-grid .corner-cell,
.excel-grid .row-number {
  min-width: 52px;
  width: 52px;
  max-width: 52px;
  text-align: center;
  color: #475467;
  background: #eef2f7;
}
.excel-grid .corner-cell {
  left: 0;
  z-index: 4;
}
.excel-grid .row-number {
  position: sticky;
  left: 0;
  z-index: 2;
  font-weight: 800;
}
.excel-grid .column-letter {
  text-align: center;
  z-index: 3;
}
.excel-grid tbody tr:nth-child(even) td {
  background: #fbfdff;
}
.excel-grid tbody tr:hover td,
.excel-grid tbody tr:hover .row-number {
  background: #eaf3ff;
}
.docx-preview p {
  max-width: 74ch;
  margin: 0 0 10px;
  line-height: 1.6;
}
.pdf-page-preview {
  display: block;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 52px 58px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(31, 41, 51, .12);
}
.pdf-page-preview h3 {
  margin: 0 0 26px;
  font-size: 22px;
  letter-spacing: 0;
}
.pdf-page-preview p {
  margin: 0 0 14px;
  max-width: 70ch;
  line-height: 1.65;
}
.dxf-preview svg {
  width: 100%;
  min-height: 520px;
  display: block;
}
.empty-preview {
  min-height: 280px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
}
.review-side .panel {
  max-height: calc(100vh - 154px);
  overflow: auto;
}
.review-note {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #bed5cc;
  border-radius: 8px;
  background: #eef7f4;
}
.review-note strong {
  display: block;
  margin-bottom: 6px;
}
.review-note p {
  margin-bottom: 8px;
  line-height: 1.55;
}
.compact-list {
  margin: 14px 0;
}
.compact-list h3,
.comment-thread h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.comment-thread {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}
.comment-card {
  padding: 11px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #f8fafc;
}
.comment-card small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}
.comment-card p {
  margin: 8px 0 0;
  line-height: 1.5;
}
.notification-list {
  display: grid;
  gap: 10px;
}
/* ── Notificaciones rediseñadas ─────────────────────────────── */
.notification-list { display: grid; gap: 10px; }
.notification-card {
  display: grid;
  gap: 6px;
  padding: 12px 16px 10px;
  border: 1px solid #d8dfe9;
  border-left: 4px solid var(--accent-2);
  border-radius: 10px;
  background: #f8fafc;
  transition: box-shadow .15s;
}
.notification-card:hover { box-shadow: 0 2px 10px rgba(20,40,80,.08); }
.notification-card.unread {
  border-left-color: var(--accent);
  background: #eef5fb;
}
/* Fila superior: fecha · hora   [tag proyecto] */
.notification-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* Botón rojo con icono de bote de basura para eliminar notificación */
.notification-dismiss-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: #dc2626;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
.notification-dismiss-btn:hover {
  background: #fee2e2;
  color: #b91c1c;
}
.notification-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.notification-project-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(27,77,137,.08);
  border-radius: 10px;
  padding: 1px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.notification-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.notification-body {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.notification-card .actions {
  justify-content: flex-start;
  margin-top: 2px;
}
/* legacy — mantener compatibilidad */
.notification-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.notification-card h3 { margin: 0; font-size: 15px; }
.notification-card p  { margin: 0; line-height: 1.45; }
.notification-card small { color: var(--muted); }
/* El chat ocupa todo el espacio del shell: bleed -28px contra el padding del shell
   para que los colores lleguen a TODAS las esquinas, sin marco blanco. */
.chat-root {
  /* Compensa el padding del shell (28px vertical, 40px horizontal) para que el
     chat siga full-bleed; por eso Mensajes no tiene el margen de las demás vistas. */
  margin: -28px -40px;
  height: 100vh;              /* ALTO FIJO: el scroll vive DENTRO, no en la página */
  background: #fff;            /* lado derecho (área de chat) en blanco */
  border-radius: 0;
  overflow: hidden;
}
.chat-layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.chat-layout.chat-detail-open {
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr) minmax(280px, 340px);
}
.chat-root .chat-sidebar.panel,
.chat-root .chat-main.panel,
.chat-detail-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
/* COMPONENTE 1 — Sidebar izquierdo: azul sólido, SIN borde, con SU PROPIO scroll. */
.chat-root .chat-sidebar.panel {
  padding: 24px 22px;
  border: 0;
  background: #3a6ea8;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}
/* Texto blanco sobre el azul sólido */
.chat-root .chat-sidebar.panel .chat-user-strip strong,
.chat-root .chat-sidebar.panel .chat-user-strip small,
.chat-root .chat-sidebar.panel h2 {
  color: #fff;
}
.chat-root .chat-sidebar.panel .chat-tabs button { color: rgba(255,255,255,.7); }
.chat-root .chat-sidebar.panel .chat-tabs button.active { color: #fff; border-bottom-color: #fff; }
.chat-root .chat-sidebar.panel .chat-conversation { color: #e8f0fb; }
/* Subtítulo y preview en claro; el chip de tipo conserva su propio color (no usar
   un selector "span" amplio que lo pisaría). */
.chat-root .chat-sidebar.panel .chat-conversation small,
.chat-root .chat-sidebar.panel .chat-conversation .chat-conversation-preview { color: rgba(232,240,251,.6); }
.chat-root .chat-sidebar.panel .chat-conversation.active,
.chat-root .chat-sidebar.panel .chat-conversation:hover {
  background: rgba(255,255,255,.15);
  border-left-color: #fff;
}
/* VISIBILIDAD sobre el azul: labels, textos y formularios (Anuncios / Crear chat). */
.chat-root .chat-sidebar.panel label,
.chat-root .chat-sidebar.panel .form-label,
.chat-root .chat-sidebar.panel .chat-create-copy,
.chat-root .chat-sidebar.panel .chat-empty-note,
.chat-root .chat-sidebar.panel p {
  color: rgba(255,255,255,.92);
}
.chat-root .chat-sidebar.panel .muted { color: rgba(255,255,255,.72); }
.chat-root .chat-sidebar.panel input:not([type="checkbox"]),
.chat-root .chat-sidebar.panel select,
.chat-root .chat-sidebar.panel textarea {
  background: #fff;
  color: #14233b;
  border-color: rgba(255,255,255,.55);
}
.chat-root .chat-sidebar.panel input::placeholder,
.chat-root .chat-sidebar.panel textarea::placeholder { color: #8aa0bd; }
.chat-root .chat-sidebar.panel .chat-contact strong { color: #fff; }
.chat-root .chat-sidebar.panel .chat-contact small { color: rgba(255,255,255,.7); }
.chat-root .chat-sidebar.panel .announcement-card strong { color: #fff; }
.chat-root .chat-sidebar.panel .announcement-card small { color: rgba(255,255,255,.62); }
.chat-root .chat-sidebar.panel .announcement-card p { color: rgba(255,255,255,.85); }
.chat-root .chat-sidebar.panel .announcement-card { border-bottom-color: rgba(255,255,255,.18); }
/* COMPONENTE 2 + 3 — Lado derecho: BLANCO, columna flex de alto fijo.
   El header y el compose quedan fijos; SOLO .chat-messages hace scroll. */
.chat-root .chat-main.panel {
  padding: 24px 28px;
  background: #fff;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.chat-detail-panel {
  min-height: calc(100vh - 132px);
  padding: 0 0 0 22px;
  margin-left: 22px;
  border-left: 1px solid var(--line);
}
.chat-sidebar,
.chat-main {
  min-height: calc(100vh - 132px);
}
.chat-user-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 0 0 16px;
  margin-bottom: 14px;
  border-bottom: 2px solid rgba(255,255,255,.4);
}
.chat-user-strip strong,
.chat-user-strip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-user-strip small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.chat-avatar,
.chat-message-avatar,
.chat-mini-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--accent);
  color: #06281f;
  font-weight: 900;
  letter-spacing: 0;
}
.chat-avatar {
  width: 34px;
  height: 34px;
  font-size: 12px;
}
.chat-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 2px solid rgba(255,255,255,.35);
}
.chat-tabs.chat-tabs-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.chat-tabs button {
  padding: 11px 8px 10px;
  border-radius: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--accent-2);
}
.chat-tabs button.active {
  background: transparent;
  border-bottom-color: var(--accent);
  color: var(--accent);
}
.chat-create-form,
.announcement-form {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.chat-create-copy {
  margin-bottom: 16px;
}
.chat-create-form input:not([type="checkbox"]),
.chat-create-form select,
.chat-create-form textarea,
.announcement-form input,
.announcement-form textarea {
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
}
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 850;
  color: var(--ink);
}
/* Picker "Usuarios disponibles" (Crear chat): tarjetas seleccionables sobre el azul. */
.chat-contact-grid {
  display: grid;
  gap: 6px;
  max-height: 290px;
  overflow: auto;
  padding: 4px 2px 2px;
}
.chat-contact {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.chat-contact:hover {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .30);
}
.chat-contact:has(input:checked) {
  background: rgba(255, 255, 255, .22);
  border-color: #fff;
  box-shadow: inset 3px 0 0 0 var(--pli-accent);
}
.chat-contact input {
  width: 16px;
  height: 16px;
  accent-color: var(--pli-accent);
  cursor: pointer;
}
/* Avatar del contacto: círculo pastel legible sobre el azul (no el cuadro oscuro). */
.chat-sidebar .chat-contact .chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #dbeafe;
  color: #12396c;
}
.chat-contact strong,
.chat-contact small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-contact small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.chat-readonly-note {
  display: grid;
  gap: 2px;
  margin-bottom: 16px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}
.chat-readonly-note small,
.chat-empty-note {
  color: var(--muted);
  font-weight: 700;
}
.chat-conversation-list,
.announcement-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border-top: 2px solid rgba(255,255,255,.35);
}
.chat-conversation {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  width: 100%;
  padding: 13px 6px 13px 10px;
  border: 0;
  border-left: 3px solid transparent;
  border-bottom: 1px solid rgba(255,255,255,.2);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.chat-conversation.active,
.chat-conversation:hover {
  border-left-color: var(--accent);
  background: rgba(231, 243, 239, .5);
}
.chat-conversation-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}
/* El título trunca con elipsis para que el sidebar no haga scroll horizontal. */
.chat-conversation-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-conversation strong,
.announcement-card strong {
  display: block;
  line-height: 1.25;
}
.chat-conversation small,
.announcement-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Preview del último mensaje: una sola línea, recortada. */
.chat-conversation-preview {
  color: var(--muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Meta row del header de conversación */
.chat-pane-title { flex: 1; min-width: 0; }
.chat-pane-name {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}
.chat-pane-project {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.chat-pane-project strong { color: var(--primary); font-weight: 700; }
.chat-pane-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.chat-type-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(27,77,137,.09);
  border-radius: 10px;
  padding: 2px 10px;
}
.chat-participants-count {
  font-size: 12px;
  color: var(--muted);
}
.chat-readonly-tag {
  font-size: 11px;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border-radius: 10px;
  padding: 2px 10px;
}
.chat-pane-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 2px solid #c8d9ee;
}
.chat-pane-head h2 {
  margin-bottom: 0;
}
.chat-pane-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.chat-members-button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}
.chat-members-button span {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  text-align: center;
}
.chat-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.participant-pill {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: #eef7f4;
  font-size: 12px;
  font-weight: 850;
}
.participant-pill.disabled {
  background: #fff1f2;
  color: #991b1b;
}
.participant-pill small {
  color: var(--muted);
  font-weight: 700;
}
.chat-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  flex: 1 1 auto;          /* llena el alto disponible -> el compose queda al fondo */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 4px;
  border-top: 2px solid #c8d9ee;
  border-bottom: 2px solid #c8d9ee;
  border-radius: 0;
  background: transparent;
}
/* ── Burbujas de chat ────────────────────────────────────────── */
.chat-message {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  width: min(72ch, 90%);
  padding: 6px 4px;
  border: 0;
  background: transparent;
}
/* Mensaje propio: avatar a la derecha, burbuja alineada derecha */
.chat-message.mine {
  flex-direction: row-reverse;
  margin-left: auto;
  justify-self: end;
}
.chat-message-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  font-size: 12px;
  background: #dbeafe;
  color: #12396c;
  border-radius: 50%;
  flex-shrink: 0;
}
.chat-message.mine .chat-message-avatar {
  background: #c9f4df;
  color: #063f30;
}
/* Contenedor de meta + burbuja de texto */
.chat-message-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}
.chat-message-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 4px;
}
.chat-message.mine .chat-message-meta {
  align-items: flex-end;
}
.chat-message-meta small {
  color: var(--muted);
  font-size: 11px;
}
/* Burbuja real */
.chat-message-body > p,
.chat-message-body .chat-bubble {
  margin: 0;
  padding: 9px 14px;
  background: #fff;
  border: 1px solid #d8dfe9;
  border-radius: 0 16px 16px 16px;
  box-shadow: 0 1px 4px rgba(20,40,80,.07);
  line-height: 1.5;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.chat-message.mine .chat-message-body > p,
.chat-message.mine .chat-message-body .chat-bubble {
  background: #e8f4fe;
  border-color: #b8d4f0;
  border-radius: 16px 0 16px 16px;
}
.chat-message p,
.announcement-card p {
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.chat-message-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
  flex-shrink: 0;           /* el compose nunca se encoge: queda fijo al fondo */
}
.chat-message-form textarea {
  min-height: 70px;
}
/* el header de la conversación tampoco se encoge */
.chat-root .chat-main.panel .chat-pane-head { flex-shrink: 0; }
/* el área central (preview de anuncio o estado vacío) llena el alto */
.chat-root .chat-main.panel .empty-preview,
.chat-root .chat-main.panel .chat-announcement-main { flex: 1 1 auto; }
.announcement-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  padding: 13px 6px 13px 12px;
  border: 0;
  border-left: 3px solid var(--accent);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.announcement-card:hover,
.announcement-card:focus-visible {
  background: rgba(231, 243, 239, .55);
}
.chat-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.chat-detail-head h2 {
  margin-bottom: 0;
}
.chat-detail-summary {
  display: grid;
  gap: 4px;
  padding-bottom: 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.chat-detail-summary small,
.chat-detail-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.chat-member-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}
.chat-member-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.chat-member-row.disabled {
  opacity: .62;
}
.chat-member-row strong,
.chat-member-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-member-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.chat-announcement-detail {
  display: grid;
  gap: 14px;
}
.chat-announcement-detail h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.18;
}
.chat-detail-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chat-detail-meta span {
  padding-right: 8px;
  border-right: 1px solid var(--line);
}
.chat-detail-meta span:last-child {
  border-right: 0;
}
.chat-announcement-detail p {
  margin: 0;
  line-height: 1.58;
}
.preview-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(760px, 92vw);
  height: 100vh;
  z-index: 20;
  padding: 22px;
  overflow: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 50px rgba(31, 41, 51, .14);
}
.preview-drawer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
}
.preview-drawer-head h2 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.preview-drawer .document-preview {
  min-height: calc(100vh - 180px);
  max-height: none;
}
.preview-drawer .pdf-frame {
  height: calc(100vh - 220px);
}
.preview-drawer .pdf-page-preview {
  width: 100%;
  min-height: calc(100vh - 190px);
}

/* PLI Borderless Operativo */
body,
.standalone-page,
.role-layout {
  background: var(--bg);
}
h1,
h2,
h3,
strong,
label,
button,
.button-link,
.badge,
.status-pill,
.sheet-head,
.eyebrow {
  font-family: "Avenir Next LT Pro", sans-serif;
}
h1,
h2,
h3,
.preview-drawer-head h2 {
  color: var(--pli-primary);
  letter-spacing: 0;
}
p,
li,
input,
select,
textarea,
.sheet-row,
.row {
  color: var(--pli-text);
}
.muted,
.sheet-row small,
.date-cell small,
.form-hint,
.chat-message-meta small,
.chat-detail-summary small,
.chat-member-row small {
  color: var(--pli-secondary);
}
.eyebrow {
  color: var(--pli-primary);
  letter-spacing: 0;
}
.sidebar {
  background: var(--pli-primary);
  border-right: 1px solid rgba(255,255,255,.22);
}
.brand small,
.session small {
  color: rgba(255,255,255,.78);
}
.mark {
  background: var(--pli-white);
  color: var(--pli-primary);
  border: 1px solid rgba(255,255,255,.5);
}
.nav {
  border-radius: 0;
  border-left: 3px solid transparent;
  color: rgba(255,255,255,.82);
}
.nav.active,
.nav:hover {
  background: rgba(255,255,255,.1);
  border-left-color: var(--pli-accent);
  color: var(--pli-white);
}
.session .ghost,
button.ghost {
  background: rgba(255,255,255,.12);
  color: var(--pli-white);
}
.shell,
.project-shell {
  background: var(--bg);
}
.lobby-page {
  background: var(--bg);
}
.lobby-card {
  background: var(--pli-white);
  border-left: 1px solid var(--line);
}
.login-card {
  background: var(--pli-white);
  border: 0;
  border-top: 8px solid var(--pli-primary);
  border-radius: 0;
  box-shadow: none;
}
.login-card.lobby-card {
  border-width: 0 0 0 1px;
  border-top: 0;
  box-shadow: none;
}
.credential-grid button {
  color: var(--pli-primary);
  background: var(--pli-bg-soft);
  border-color: var(--pli-line);
}
.panel,
.metrics article,
.project-side-tabs,
.project-tab-panel,
.subpanel,
.detail-grid article,
.inspector,
.edit-shell,
.user-profile-card,
.review-note,
.comment-card,
.notification-card,
.empty-preview {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}
.panel {
  padding: 20px 0;
}
.panel-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.metrics article,
.context-rail article {
  background: var(--pli-white);
  border: 0;
  border-left: 4px solid var(--pli-accent);
  border-radius: 0;
}
.metrics span,
.context-rail strong,
.canonical-line {
  color: var(--pli-primary);
}
input,
select,
textarea,
.column-chooser summary,
.table-pref-menu summary {
  background: var(--pli-white);
  border: 1px solid var(--pli-line);
  border-radius: 4px;
  color: var(--pli-text);
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(115,157,211,.42);
  outline-offset: 1px;
  border-color: var(--pli-secondary);
}
input.is-invalid,
select.is-invalid,
textarea.is-invalid,
.area-picker.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .08);
}
button,
.button-link {
  background: var(--pli-primary);
  color: var(--pli-white);
  border-radius: 4px;
  box-shadow: none;
}
button.secondary,
.button-link.secondary,
.icon-button,
.notification-button {
  background: var(--pli-secondary);
  color: var(--pli-white);
}
button.danger {
  background: var(--danger);
  color: var(--pli-white);
}
button:hover,
.button-link:hover {
  filter: brightness(.96);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--pli-accent);
  outline-offset: 2px;
}
.sidebar button:focus-visible,
.sidebar a:focus-visible {
  outline-color: rgba(255,255,255,.76);
}
.icon-button,
.return-button {
  border-radius: 4px;
}
.notification-button.has-unread {
  background: var(--pli-primary);
}
.notification-count {
  background: #C8271D;
  border-color: var(--bg);
}
.project-card {
  background: var(--pli-white);
  border: 0;
  border-left: 4px solid var(--pli-primary);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}
.project-card:hover,
.project-row-link:hover,
.as-row:hover {
  background: var(--pli-hover) !important;
  border-color: var(--pli-accent);
  transform: none;
}
.project-card-phase,
.project-card-metrics span {
  background: var(--pli-bg-soft);
  border: 0;
  border-radius: 0;
}
.project-card-metrics b {
  color: var(--pli-primary);
}
.toolbar,
.assets-toolbar,
.compact-toolbar,
.project-file-controls {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.row,
.sheet-row {
  background: var(--pli-white);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.matrix-table .sheet-row {
  border-left: 0;
  border-right: 0;
}
.matrix-table .sheet-row:not(.sheet-head):nth-child(odd) {
  background: #F8FBFF;
}
.matrix-table .sheet-row:not(.sheet-head):nth-child(even) {
  background: var(--pli-white);
}
.sheet-head,
.matrix-table .sheet-head,
th {
  background: var(--pli-primary);
  color: var(--pli-white);
}
.sheet-head > *,
.matrix-table .sheet-head > *,
th {
  color: var(--pli-white);
}
.matrix-table .sheet-row > *,
th,
td {
  border-color: var(--pli-line);
}
table,
.spreadsheet-preview,
.docx-preview,
.dxf-preview,
.pdf-page-preview,
.pdf-frame,
.pdf-preview,
.image-preview,
.sheet-scroll,
.document-preview {
  background: var(--pli-white);
  border-color: var(--pli-line);
  border-radius: 0;
  box-shadow: none;
}
.table-pref-menu summary,
.column-chooser summary {
  color: var(--pli-primary);
  font-weight: 850;
}
.table-pref-menu summary:hover {
  background: var(--pli-hover);
  border-color: var(--pli-secondary);
}
.table-pref-panel,
.column-grid {
  background: var(--pli-white);
  border: 1px solid var(--pli-line);
  border-radius: 0;
  box-shadow: none;
}
.table-resize-handle::after {
  background: var(--pli-accent);
}
.badge,
.status-neutral,
.role-pill {
  background: var(--pli-bg-soft);
  color: var(--pli-primary);
}
.status-active {
  background: #E5F6EC;
  color: #11623B;
}
.status-inactive {
  background: #FDE7E5;
  color: #9F241B;
}
.status-pending {
  background: #E6F0FB;
  color: var(--pli-primary);
}
.status-warning {
  background: #FFF5D8;
  color: #7A5200;
}
.area-picker,
.area-option-card,
.smart-user-picker,
.smart-user-results,
.team-user-result,
.selected-user-chip,
.user-key-grid article {
  background: var(--pli-white);
  border-color: var(--pli-line);
  border-radius: 0;
  box-shadow: none;
}
.area-option-card.selected,
.team-user-result.selected,
.team-user-result.is-selected {
  background: var(--pli-hover);
  border-color: var(--pli-secondary);
}
.project-side-tabs {
  padding: 0;
  border-top: 0;
}
.project-tab-button {
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--pli-text);
}
.project-tab-button.active,
.project-tab-button:hover {
  background: var(--pli-hover);
  border-left-color: var(--pli-primary);
  color: var(--pli-primary);
}
.project-tab-button small {
  background: var(--pli-bg-soft);
  color: var(--pli-primary);
}
.project-tab-button.active small,
.project-tab-button:hover small {
  background: var(--pli-primary);
  color: var(--pli-white);
}
.preview-drawer {
  background: var(--pli-white);
  border-left: 1px solid var(--pli-line-strong);
  box-shadow: none;
}
.preview-drawer-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.toast {
  background: var(--pli-primary);
  color: var(--pli-white);
  border-radius: 0;
  box-shadow: none;
}
/* El área de chat (main) va BLANCA; solo el detail-panel transparente. */
.chat-root .chat-main.panel {
  background: #fff;
}
.chat-detail-panel {
  background: transparent;
  border-color: var(--line);
}
/* El sidebar PLI ya está definido con color sólido arriba; solo ajustar avatares/tabs.
   Los avatares de MENSAJE conservan el círculo pastel del Design System (definido
   arriba: #dbeafe/#12396c, y mine #c9f4df/#063f30) — NO se sobrescriben aquí.
   El avatar del strip de usuario del sidebar va en tile blanco para leerse sobre azul. */
.chat-root .chat-sidebar.panel .chat-user-strip .chat-avatar {
  background: var(--pli-white);
  color: var(--pli-primary);
}
/* Tabs del sidebar sobre azul: ya están en blanco arriba; las del area principal en PLI */
.chat-root .chat-main.panel .chat-tabs button {
  color: var(--pli-secondary);
}
.chat-root .chat-main.panel .chat-tabs button.active {
  border-bottom-color: var(--pli-primary);
  color: var(--pli-primary);
}
.chat-contact,
.chat-conversation,
.announcement-card,
.chat-member-row {
  background: transparent;
  border-color: var(--line);
  border-radius: 0;
}
/* chat-message: no sobrescribir — los estilos de burbuja están arriba */
.chat-conversation.active,
.chat-conversation:hover,
.announcement-card:hover,
.announcement-card:focus-visible {
  background: var(--pli-hover);
  border-left-color: var(--pli-primary);
}
/* Burbuja PLI: ajustar colores de marca sin romper la forma redondeada */
.chat-message-body > p { border-color: #d0dae8; }
.chat-message.mine .chat-message-body > p { background: #e3eefb; border-color: #aec8ec; }
.chat-mini-avatar,
.chat-members-button span {
  background: var(--pli-bg-soft);
  color: var(--pli-primary);
}
.chat-message-form {
  border-color: var(--line);
}
.chat-readonly-note {
  background: var(--pli-bg-soft);
  color: var(--pli-primary);
}
@media (max-width: 980px) {
  .lobby-shell {
    position: static;
    min-height: auto;
    overflow: visible;
    grid-template-columns: 1fr;
    padding: 26px 18px;
  }
  .lobby-hero {
    width: 100%;
    min-height: auto;
    gap: 22px;
    padding-top: 8px;
  }
  .lobby-hero h1 {
    font-size: 32px;
  }
  .login-card.lobby-card {
    width: 100%;
  }
  .credential-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sidebar { position: static; width: auto; height: auto; min-height: auto; }
  .shell { margin-left: 0; }
  .role-layout .project-shell { margin-left: 0; width: 100%; }
  nav { grid-template-columns: repeat(2, 1fr); }
  .login-card, .grid-form, .two-col, .detail-grid { grid-template-columns: 1fr; }
  .metrics, .context-rail { grid-template-columns: repeat(2, 1fr); }
  .toolbar, .assets-toolbar, .compact-toolbar { grid-template-columns: 1fr; }
  .row, .row.wide { grid-template-columns: 1fr; }
  .sheet-row, .users-sheet, .projects-sheet, .assets-sheet, .versions-sheet, .review-sheet, .bitacora-sheet, .audit-head, .audit-row, .role-five, .role-four, .role-projects { grid-template-columns: 1fr; }
  .inspector-grid { grid-template-columns: 1fr; }
  .actions { justify-content: flex-start; }
  .project-header, .pulse-grid, .project-workspace, .project-file-controls { grid-template-columns: 1fr; }
  .project-side-tabs {
    position: static;
  }
  .project-tab-button {
    min-height: 50px;
  }
  .project-card-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .column-grid {
    position: static;
    width: 100%;
  }
  .chat-layout,
  .chat-layout.chat-detail-open { grid-template-columns: 1fr; }
  .chat-sidebar,
  .chat-main,
  .chat-detail-panel { min-height: auto; }
  .chat-root .chat-sidebar.panel {
    padding: 0 0 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .chat-root .chat-main.panel,
  .chat-detail-panel {
    padding: 18px 0 0;
    margin-left: 0;
    border-left: 0;
  }
  .chat-message { width: 100%; }
  .chat-message-form { grid-template-columns: 1fr; }
  .preview-expanded .pulse-grid { grid-template-columns: 1fr; }
  .preview-drawer { width: 100vw; }
  .preview-drawer-head { grid-template-columns: 1fr; }
  .smart-user-filters,
  .team-picker-row,
  .team-user-result {
    grid-template-columns: 1fr;
  }
}

/* Pre-launch access gate */
.lobby-page {
  min-height: 100vh;
  overflow: hidden;
  background: var(--pli-white);
}
.access-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(480px, 1.08fr) minmax(420px, .92fr);
  background: var(--pli-white);
}
.access-shell > * {
  min-width: 0;
}
.access-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  align-items: center;
  min-height: 100vh;
  padding: 64px;
  color: var(--pli-white);
  background: #004f9f;
}
.access-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: .55;
}
.access-hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 44px;
  max-width: 680px;
}
.access-brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
}
.access-mark {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--pli-white);
  border: 1px solid rgba(255,255,255,.58);
}
.access-mark img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}
.access-brand-lockup small {
  display: block;
  margin-bottom: 2px;
  color: rgba(255,255,255,.72);
  font-size: 14px;
  font-weight: 800;
}
.access-brand-lockup strong {
  display: block;
  color: var(--pli-white);
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0;
}
.access-copy {
  display: grid;
  gap: 18px;
}
.access-kicker {
  width: fit-content;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 8px;
  color: var(--pli-white);
  background: rgba(255,255,255,.12);
  font-size: 13px;
  font-weight: 900;
}
.access-copy h1 {
  max-width: 9em;
  margin: 0;
  color: var(--pli-white);
  font-size: 58px;
  line-height: 1;
  letter-spacing: 0;
}
.access-copy p:not(.access-kicker) {
  max-width: 30em;
  margin: 0;
  color: rgba(255,255,255,.86);
  font-size: 20px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}
.access-signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.access-signal-grid article {
  min-height: 112px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 8px;
  background: rgba(255,255,255,.1);
}
.access-signal-grid span {
  width: 11px;
  height: 11px;
  display: block;
  border-radius: 999px;
  background: #3ddc97;
  box-shadow: 0 0 0 0 rgba(61,220,151,.52);
  animation: accessSignal 2s ease-out infinite;
}
.access-signal-grid strong {
  display: block;
  color: var(--pli-white);
  font-size: 17px;
}
.access-signal-grid small {
  display: block;
  color: rgba(255,255,255,.7);
  font-weight: 800;
}
.access-panel {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 64px;
  background:
    linear-gradient(180deg, rgba(238,244,251,.92), rgba(255,255,255,1) 46%),
    var(--pli-white);
}
.access-card {
  width: 100%;
  max-width: 560px;
  min-width: 0;
  display: grid;
  gap: 28px;
  padding: 0;
}
.access-card-head {
  display: grid;
  gap: 18px;
}
.access-logo {
  width: 260px;
  max-width: 78%;
  height: auto;
  margin-bottom: 12px;
}
.access-card h2 {
  margin: 0;
  color: var(--pli-primary);
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: 0;
}
.access-form {
  display: grid;
  gap: 16px;
}
.access-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}
.access-form label span {
  color: var(--ink);
}
.access-form input {
  width: 100%;
  height: 56px;
  border: 1px solid var(--pli-line);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--pli-white);
  font-size: 16px;
  font-weight: 800;
}
.access-form input:focus {
  outline: 3px solid rgba(49,101,175,.18);
  border-color: var(--pli-secondary);
}
.access-form button[type="submit"] {
  position: relative;
  min-height: 58px;
  overflow: hidden;
  border-radius: 8px;
  color: var(--pli-white);
  background: var(--pli-primary);
  font-size: 16px;
}
.access-form button[type="submit"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  transform: translateX(-100%);
  transition: transform .55s ease;
}
.access-form button[type="submit"]:hover::after {
  transform: translateX(100%);
}
.access-form button[type="submit"] span {
  position: relative;
  z-index: 1;
}
.password-field {
  position: relative;
  display: block;
}
.password-field input {
  padding-right: 58px;
}
.password-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 42px;
  min-width: 42px;
  height: 40px;
  min-height: 40px !important;
  padding: 0 !important;
  border: 1px solid var(--pli-line) !important;
  border-radius: 4px !important;
  color: var(--pli-primary) !important;
  background: var(--pli-white) !important;
}
.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Assisted upload naming */
.upload-assist-card {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--pli-line);
  border-left: 4px solid var(--pli-secondary);
  border-radius: 6px;
  background: var(--pli-white);
}
.upload-assist-card.is-empty {
  border-left-color: var(--pli-line-strong);
  background: var(--pli-bg-soft);
}
.upload-assist-card.is-new {
  border-left-color: #8A5A00;
  background: #FFFDF3;
}
.upload-assist-card.is-match {
  border-left-color: #11623B;
  background: #F6FCF8;
}
.upload-assist-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.upload-assist-card > div:first-child span {
  color: var(--pli-secondary);
  font-size: 12px;
  font-weight: 850;
}
.upload-assist-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.upload-assist-card dl div {
  min-width: 0;
}
.upload-assist-card dt {
  color: var(--pli-secondary);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.upload-assist-card dd {
  min-width: 0;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}
.upload-assist-card code {
  color: var(--pli-primary);
  font-weight: 900;
}
.upload-assist-card p {
  margin: 0;
}
.upload-assist-card details {
  border-top: 1px solid var(--pli-line);
  padding-top: 8px;
}
.upload-assist-card summary {
  cursor: pointer;
  color: var(--pli-primary);
  font-weight: 850;
}
.upload-assist-card details small {
  display: block;
  margin-top: 5px;
}

/* Review page adjustments from field screenshots */
.review-page .project-shell {
  width: min(calc(100% - 144px), 1540px);
  max-width: 1540px;
  padding: 32px 0;
}
.review-page .project-header {
  margin-bottom: 18px;
}
.review-page .panel {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--pli-line);
  border-radius: 8px;
  background: var(--pli-white);
}
.review-page .panel-heading {
  margin: 0;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--pli-line);
}
.section-title-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.section-title-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.review-page #uploadPanel,
.review-page #versionHistory,
.review-page #commentForm {
  margin: 0;
  padding: 16px 18px;
}
.review-page #uploadPanel {
  display: grid;
  gap: 18px;
  padding: 20px 18px 24px;
  border-width: 0 0 1px;
  border-radius: 0;
}
.review-page #uploadPanel label {
  margin: 0;
}
.review-page #uploadPanel .actions {
  padding-top: 4px;
}
.review-page .review-note {
  border: 0;
  border-bottom: 1px solid var(--pli-line);
  background: var(--pli-white);
}
.review-page .version-table {
  min-width: 980px;
}
.review-page .version-table-body {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--pli-line);
  border-top: 0;
}
.review-page .vrow {
  padding: 12px 10px;
}
.review-page .vrow.vhead {
  border-radius: 6px 6px 0 0;
}
.review-page .vcol-file strong {
  overflow-wrap: anywhere;
}
.version-note {
  margin-top: 4px;
}
.version-note summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  cursor: pointer;
  color: var(--pli-secondary);
  font-size: 12px;
  font-weight: 850;
  list-style: none;
}
.version-note summary::-webkit-details-marker {
  display: none;
}
.version-note summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  color: var(--pli-white);
  background: var(--pli-primary);
  font-size: 12px;
  line-height: 1;
}
.version-note[open] summary::before {
  content: "-";
}
.version-note small {
  display: block;
  max-width: 70ch;
  margin-top: 6px;
  line-height: 1.45;
}
.review-page .preview-panel #previewBox {
  min-height: 0;
  max-height: 64vh;
  overflow: auto;
  padding: 16px 18px;
}
.review-page .preview-panel #previewBox.hidden {
  display: none;
}
.review-page .preview-panel .panel-heading {
  align-items: center;
}
.review-page .preview-panel .panel-heading .muted {
  max-width: 92ch;
}
.review-page .preview-panel .pdf-frame {
  min-height: 58vh;
}
.review-page .preview-standby {
  min-height: 180px;
}
.review-page .comment-thread {
  max-height: 430px;
  overflow-y: auto;
  padding: 16px 18px;
  margin: 0;
  border-bottom: 1px solid var(--pli-line);
  background: #F8FBFF;
}
.review-page .comment-card {
  width: fit-content;
  max-width: min(72%, 760px);
  padding: 11px 13px;
  border: 1px solid var(--pli-line);
  border-radius: 8px;
  background: var(--pli-white);
}
.review-page .comment-card.is-own {
  justify-self: end;
  border-color: #AEC8EC;
  background: #EAF3FF;
}
.review-page .comment-card.is-other {
  justify-self: start;
}
.review-page #commentForm {
  border-top: 0;
}
@keyframes accessSignal {
  0% { box-shadow: 0 0 0 0 rgba(61,220,151,.52); }
  70% { box-shadow: 0 0 0 10px rgba(61,220,151,0); }
  100% { box-shadow: 0 0 0 0 rgba(61,220,151,0); }
}
@media (max-width: 980px) {
  .lobby-page {
    overflow: auto;
  }
  .access-shell {
    grid-template-columns: 1fr;
  }
  .access-hero {
    min-height: auto;
    padding: 34px 22px;
  }
  .access-hero-content {
    gap: 24px;
  }
  .access-mark {
    width: 64px;
    height: 64px;
  }
  .access-brand-lockup strong {
    font-size: 32px;
  }
  .access-copy h1 {
    font-size: 40px;
  }
  .access-copy p:not(.access-kicker) {
    font-size: 17px;
  }
  .access-signal-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .access-signal-grid article {
    min-height: 70px;
    padding: 12px;
  }
  .access-panel {
    min-height: auto;
    padding: 32px 22px 42px;
  }
  .access-card h2 {
    font-size: 34px;
  }
}
@media (max-width: 640px) {
  .access-shell,
  .access-hero,
  .access-panel {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .access-hero {
    padding: 28px 22px 30px;
  }
  .access-hero-content,
  .access-card {
    width: 100%;
    max-width: 346px;
  }
  .access-brand-lockup {
    gap: 14px;
  }
  .access-mark {
    width: 56px;
    height: 56px;
  }
  .access-brand-lockup small {
    font-size: 13px;
  }
  .access-brand-lockup strong {
    font-size: 30px;
  }
  .access-copy {
    gap: 12px;
  }
  .access-copy h1 {
    font-size: 34px;
  }
  .access-copy p:not(.access-kicker) {
    font-size: 16px;
    max-width: 100%;
  }
  .access-signal-grid {
    display: none;
  }
  .access-panel {
    padding: 28px 22px 36px;
  }
  .access-form,
  .access-form input {
    max-width: 100%;
  }
  .upload-assist-card dl {
    grid-template-columns: 1fr;
  }
  .review-page .project-shell {
    width: calc(100% - 28px);
    padding: 18px 0;
  }
  .review-page .comment-card {
    max-width: 92%;
  }
}

/* Paginación cursor-based (#13): botón "Cargar más" centrado bajo las matrices. */
.load-more-row {
  display: flex;
  justify-content: center;
  padding: 14px 0 6px;
}
.load-more-row button {
  min-width: 160px;
}
.load-more-row button[disabled] {
  opacity: 0.6;
  cursor: default;
}

/* Botón principal "Regresar a menú" en cabeceras de archivo/revisión.
   Selector compuesto para ganarle al .button-link suave del Design System. */
.button-link.return-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--pli-primary);
  color: var(--pli-white);
  border: 1px solid var(--pli-primary);
}
.button-link.return-menu-btn:hover {
  background: var(--pli-secondary);
  border-color: var(--pli-secondary);
  color: var(--pli-white);
}
.button-link.return-menu-btn svg {
  width: 14px;
  height: 14px;
}

/* Vista previa del nombre controlado en el cuestionario de alta de archivo. */
.upload-name-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px dashed var(--pli-line-strong);
  border-radius: 8px;
  background: var(--pli-bg-soft);
}
.upload-name-preview span {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--pli-secondary);
}
.upload-name-preview code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--pli-primary);
  word-break: break-all;
}

/* Disciplina única de un área: se muestra fija (sin select) en el cuestionario. */
.field-static {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 11px;
  border: 1px solid var(--pli-line);
  border-radius: 7px;
  background: var(--pli-bg-soft);
}
.field-static span {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--pli-secondary);
}
.field-static strong {
  font-size: 14px;
  color: var(--pli-primary);
}
