:root {
  --ink: #1f2124;
  --muted: #5f6368;
  --paper: #f4f4f3;
  --surface: #ffffff;
  --line: #e3e3e1;
  --line-strong: #c4c4c1;
  --input-border: #8f9195;
  --brand: #c8282d;
  --on-brand: #ffffff;
  --error: #a3191e;
  --gray-1: #f4f4f3;
  --gray-2: #ececea;
  --gray-3: #e0e0dd;
  --font: system-ui,"Segoe UI",Arial,sans-serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none!important;
}

body {
  margin: 0;
}

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

button,a,input,select,textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
  min-height: 44px;
}

button:disabled {
  opacity: .55;
  cursor: wait;
}

button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

a {
  color: var(--ink);
}

h1,h2,h3,p {
  margin: 0;
}

h1 {
  font: 600 38px/1.2 var(--font);
  letter-spacing: -.7px;
}

h2 {
  font: 600 29px/1.25 var(--font);
}

h3 {
  font-size: 17px;
}

p {
  line-height: 1.6;
}

small,.hint {
  font-size: 12px;
  line-height: 1.6;
}

.muted,.hint {
  color: var(--muted);
}

.eyebrow {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--muted);
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin: 15px 0;
}

input,select,textarea {
  display: block;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--input-border);
  background: var(--surface);
  border-radius: 8px;
  margin-top: 7px;
  color: var(--ink);
  min-height: 44px;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input[type=file] {
  font-size: 12px;
}

button {
  border-radius: 7px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
}

.secondary {
  background: var(--surface);
}

.danger {
  color: var(--error);
}

.full {
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.logo {
  display: block;
  width: 170px;
  max-width: 100%;
  height: auto;
}

.brand small {
  display: block;
  letter-spacing: 2px;
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
}

.welcome .brand {
  align-self: flex-start;
  background: var(--surface);
  padding: 10px 14px;
  border-radius: 8px;
}

.welcome .logo {
  width: 190px;
}

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.welcome {
  background: linear-gradient(180deg,#1f21245c,#1f2124e0),url('/catalogo/roble.jpg') center/cover;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 45px;
}

.welcome .eyebrow {
  color: #e3e3e1;
}

.welcome h1 {
  font-size: 51px;
  margin: 20px 0;
}

.welcome small {
  color: #e3e3e1;
}

.auth-side {
  display: grid;
  place-items: center;
  padding: 45px;
}

.auth-form {
  width: 100%;
  max-width: 400px;
}

.auth-form h2 {
  margin: 20px 0 13px;
}

.auth-footer {
  margin-top: 40px;
  color: var(--muted);
  font-size: 11px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  gap: 15px;
  margin: 22px 0;
}

.tabs button {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 12px 3px;
  font-size: 13px;
  color: var(--muted);
}

.tabs .selected {
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
  font-weight: 600;
}

.error {
  color: var(--error);
  font-size: 13px;
  margin: 14px 0;
  min-height: 20px;
}

.workspace {
  display: flex;
  min-height: 100vh;
}

aside {
  width: 235px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  color: var(--ink);
  padding: 35px 23px 20px;
  display: flex;
  flex-direction: column;
}

.nav-title {
  margin: 50px 0 17px;
  color: var(--muted);
}

nav {
  display: grid;
  gap: 7px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  min-height: 49px;
  padding: 11px;
}

.nav>span {
  font-size: 21px;
  width: 22px;
}

.nav.active {
  background: var(--gray-1);
  box-shadow: inset 3px 0 var(--brand);
  font-weight: 600;
}

.badge {
  margin-left: auto;
  border-radius: 20px;
  min-width: 23px;
  padding: 3px 6px;
  text-align: center;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 11px;
}

.aside-bottom {
  margin-top: auto;
}

.aside-bottom>p {
  font: 20px/1.4 var(--font);
  margin: 50px 0 35px;
  color: var(--muted);
}

.account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  font-size: 11px;
}

.account small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.account button {
  background: transparent;
  color: var(--ink);
  border: 0;
  padding: 8px;
}

main {
  margin-left: 235px;
  width: calc(100% - 235px);
}

.topbar {
  height: 75px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 42px;
  font-size: 11px;
}

.topbar>span:last-child {
  color: var(--muted);
}

.content {
  max-width: 1440px;
  margin: auto;
  padding: 38px 42px 20px;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.page-title h1 {
  margin: 10px 0;
}

.page-title p:last-child {
  font-size: 12px;
}

.page-title button {
  white-space: nowrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

.stat span {
  font-size: 11px;
  color: var(--muted);
}

.stat strong {
  display: block;
  font: 600 32px var(--font);
  margin: 12px 0 3px;
}

.filters {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.filters label {
  margin: 0;
  flex: 1;
  min-width: 150px;
}

.filters input,.filters select {
  margin-top: 6px;
}

.filters button {
  height: 44px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 17px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.card.new {
  border-color: var(--brand);
}

.card-cover {
  height: 118px;
  background: var(--gray-2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.folio {
  position: absolute;
  left: 12px;
  top: 12px;
  font-size: 10px;
  background: #ffffffed;
  padding: 5px 7px;
  border-radius: 4px;
}

.new-dot {
  position: absolute;
  right: 13px;
  top: 14px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 9px;
  padding: 5px 8px;
  border-radius: 20px;
}

.card-body {
  padding: 18px;
}

.chip {
  display: inline-block;
  border-radius: 4px;
  font-size: 9px;
  padding: 5px 7px;
  background: var(--gray-2);
  color: var(--ink);
  margin-bottom: 12px;
}

.card h3 {
  margin-bottom: 8px;
  line-height: 1.4;
}

.card p {
  font-size: 12px;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
  margin-top: 16px;
}

.card-foot span {
  font-size: 10px;
  color: var(--muted);
}

.card-foot button {
  padding: 8px 11px;
  min-height: 38px;
  font-size: 11px;
}

.empty {
  padding: 55px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
  color: var(--muted);
}

.notice {
  padding: 14px 17px;
  border: 1px solid var(--line);
  background: var(--gray-1);
  border-radius: 8px;
  font-size: 12px;
  margin: 15px 0;
  line-height: 1.6;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,td {
  text-align: left;
  padding: 15px 13px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-size: 10px;
  background: var(--gray-1);
  font-weight: 600;
}

td button {
  font-size: 11px;
  padding: 7px 10px;
  margin-right: 6px;
}

.tag {
  font-size: 10px;
  padding: 5px 7px;
  border-radius: 4px;
  background: var(--gray-2);
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.pager {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  margin-top: 25px;
  font-size: 12px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  font-size: 10px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 25px;
  margin-top: 40px;
}

dialog {
  border: 0;
  padding: 25px;
  width: 650px;
  max-width: 100%;
  height: 96vh;
  max-height: 96vh;
  margin: 2vh auto;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 15px 80px #1f212433;
}

dialog::backdrop {
  background: #1f212466;
}

.drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.icon {
  background: transparent;
  border: 0;
  font-size: 28px;
  padding: 5px 10px;
}

#detail h2 {
  margin: 10px 0;
}

#detail p {
  font-size: 13px;
}

.detail-block {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 20px;
}

.detail-block h3 {
  margin: 0 0 12px;
}

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

.detail-grid label {
  margin: 0;
}

.messages {
  display: grid;
  gap: 10px;
  margin-top: 15px;
  max-height: 360px;
  overflow: auto;
  padding: 8px 0;
}

.bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  max-width: 94%;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble.team {
  margin-left: auto;
  background: var(--gray-2);
}

.bubble small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 5px;
}

.bubble a {
  display: block;
  font-size: 11px;
  margin-top: 8px;
}

.activity {
  font-size: 11px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  background: var(--ink);
  color: #ffffff;
  padding: 13px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 5;
}

.catalog-description {
  padding: 18px;
  font-size: 12px;
  line-height: 1.6;
}

.catalog-description h3 {
  margin-bottom: 9px;
}

.catalog-photo {
  height: 170px;
  width: 100%;
  object-fit: cover;
}

/* 4.3 Catálogo real: buscador, filtros, tarjetas y «Ver más». */
.catalog-photo {
  display: block;
  background: var(--gray-1);
  /* 4.3 FASE B: la foto se ve completa (sin recortar) sobre gris claro. */
  object-fit: contain;
  object-position: center;
  padding: 6px;
  box-sizing: border-box;
}

/* 4.4 tarjetas: la tarjeta (4:5) se ve completa, sin margen. */
.catalog-photo.catalog-tarjeta {
  height: auto;
  aspect-ratio: 4 / 5;
  padding: 0;
  object-fit: contain;
}

.catalog-nophoto {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.catalog-filters .catalog-check {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
}

.catalog-filters .catalog-check input {
  margin: 0;
  width: auto;
}

.catalog-count {
  margin: -10px 0 14px;
  font-size: 13px;
}

.catalog-popular {
  background: var(--brand);
  color: var(--on-brand);
}

/* 4.18b destacados de la gerencia */
.catalog-destacado {
  background: #fff4d6;
  color: #7a5200;
  border: 1px solid #e9c46a;
  margin-right: 6px;
}

.catalog-destacar {
  margin-top: 8px;
}

.catalog-meta {
  font-weight: 600;
}

.catalog-code {
  font-size: 11px;
  word-break: break-word;
}

.catalog-link {
  font-size: 12px;
  color: var(--brand);
}

.catalog-more {
  display: flex;
  justify-content: center;
  margin: 20px 0 8px;
}

@media(max-width:1100px) {
  .cards {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .content {
    padding: 30px 25px;
  }
  .topbar {
    padding: 0 25px;
  }
}

@media(max-width:760px) {
  aside {
    position: static;
    width: 100%;
    padding: 17px 18px 0;
    display: block;
  }
  .workspace {
    display: block;
  }
  .logo {
    width: 130px;
  }
  .welcome .logo {
    width: 150px;
  }
  .brand small {
    font-size: 8px;
  }
  .nav-title,.aside-bottom>p {
    display: none;
  }
  nav {
    display: flex;
    overflow: auto;
    gap: 4px;
    margin-top: 15px;
  }
  .nav {
    white-space: nowrap;
    min-height: 47px;
    font-size: 11px;
  }
  .nav.active {
    box-shadow: inset 0 -3px var(--brand);
  }
  .nav>span {
    display: none;
  }
  .badge {
    margin-left: 3px;
  }
  .aside-bottom {
    position: absolute;
    right: 12px;
    top: 12px;
  }
  .account {
    border: 0;
    padding: 0;
  }
  .account strong {
    font-size: 10px;
  }
  .account small {
    font-size: 9px;
  }
  .account button {
    font-size: 17px;
  }
  main {
    margin: 0;
    width: 100%;
  }
  .topbar {
    height: 48px;
    padding: 0 18px;
  }
  .content {
    padding: 25px 18px;
  }
  .page-title h1 {
    font-size: 29px;
  }
  .page-title {
    align-items: start;
    gap: 8px;
  }
  .page-title button {
    font-size: 11px;
    padding: 9px;
    min-height: 40px;
  }
  .stats {
    gap: 8px;
    margin-bottom: 22px;
  }
  .stat {
    padding: 13px 10px;
  }
  .stat span {
    font-size: 9px;
  }
  .stat strong {
    font-size: 27px;
  }
  .cards {
    gap: 12px;
  }
  .card-cover {
    height: 95px;
  }
  .card-body {
    padding: 13px;
  }
  .card h3 {
    font-size: 14px;
  }
  .card-foot {
    flex-wrap: wrap;
  }
  .filters label {
    min-width: 130px;
  }
  .filters button {
    flex: 1;
  }
  .auth {
    display: block;
  }
  .welcome {
    min-height: 160px;
    padding: 23px;
  }
  .welcome>div:nth-child(2),.welcome>small {
    display: none;
  }
  .auth-side {
    padding: 35px 24px;
  }
  .auth-form h2 {
    font-size: 30px;
  }
  .auth-footer {
    margin-top: 25px;
  }
  dialog {
    margin: 0;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 20px;
  }
  footer {
    font-size: 9px;
  }
  .page-title .eyebrow {
    font-size: 8px;
  }
}

@media(max-width:420px) {
  .cards {
    grid-template-columns: 1fr;
  }
  .card-cover {
    height: 125px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .account strong {
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .page-title h1 {
    font-size: 26px;
  }
  .stats {
    grid-template-columns: repeat(3,minmax(0,1fr));
  }
}

.bot-status {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin: 12px 0;
}

.bot-status strong {
  display: block;
  font-size: 14px;
}

.bot-status p {
  margin-top: 5px;
}

.bot-status.automatico {
  background: var(--surface);
  border-color: var(--line);
}

.bot-status.espera {
  background: var(--gray-2);
  border-color: var(--line-strong);
}

.bot-status.personal {
  background: var(--gray-3);
  border-color: #a9a9a5;
}

.quote-preview {
  margin-top: 18px;
  padding: 17px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.quote-preview pre {
  font: 14px/1.6 var(--font);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 12px 0;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.6;
}

.check-row input {
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  margin: 0;
}

.order-editor summary {
  cursor: pointer;
  min-height: 44px;
  padding: 8px 0;
  font-weight: 600;
}

.edit-model {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  margin: 12px 0;
}

.change-notice {
  border-top: 3px solid var(--muted);
}

.messages {
  overflow-anchor: none;
  scrollbar-gutter: stable;
  min-height: 80px;
}

.bubble {
  min-width: 0;
}

#jump-messages {
  margin-top: 8px;
}

dialog {
  overscroll-behavior: contain;
}

#detail input,#detail select,#detail textarea {
  max-width: 100%;
}

@media(max-width:760px) {
  #detail .row-actions button {
    flex: 1;
    min-width: 140px;
  }
  #detail input,#detail select,#detail textarea {
    font-size: 16px;
  }
  .quote-preview {
    padding: 12px;
  }
  .messages {
    max-height: 42dvh;
  }
  .bot-status {
    padding: 12px;
  }
  #detail .detail-block {
    overflow-wrap: anywhere;
  }
}

/* ===== Fase 2: Solicitudes en tres columnas (solo de 761 px en adelante) ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body.inbox-mode {
  overflow: hidden;
}

body.inbox-mode .content {
  max-width: none;
  padding: 0;
}

body.inbox-mode .page-title,body.inbox-mode footer {
  display: none;
}

.inbox {
  display: grid;
  grid-template-columns: 320px minmax(0,1fr) 300px;
  height: calc(100vh - 75px);
  height: calc(100dvh - 75px);
  background: var(--surface);
}

.inbox>* {
  min-width: 0;
  min-height: 0;
}

.inbox h2 {
  font-size: 20px;
}

.inbox p {
  font-size: 13px;
}

/* Columna izquierda */
.inbox-list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.list-head {
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-btn {
  min-height: 36px;
  min-width: 36px;
  padding: 4px 9px;
  font-size: 17px;
  background: transparent;
  border-color: transparent;
}

.icon-btn:hover {
  background: var(--gray-1);
}

.list-head input[type=search] {
  margin-top: 12px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 12px;
}

.pill b {
  font-weight: 600;
  color: var(--muted);
}

.pill:hover {
  background: var(--gray-1);
}

.pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
  font-weight: 600;
}

.pill.active b {
  color: #ffffff;
}

.pills-note {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.45;
}

.list-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.list-tools select {
  margin: 0;
  min-height: 34px;
  padding: 5px 8px;
  font-size: 12px;
  flex: 1;
  min-width: 0;
}

.chat-list {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
}

.chat-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 74px;
  padding: 12px 16px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
}

.chat-row:hover {
  background: var(--gray-1);
}

.chat-row:focus-visible {
  outline-offset: -3px;
}

.chat-row.selected {
  background: var(--gray-2);
  box-shadow: inset 3px 0 var(--brand);
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-3);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.row-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.row-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.row-top strong {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-row.unread .row-top strong {
  font-weight: 700;
}

.row-top time {
  flex: none;
  font-size: 11px;
  color: var(--muted);
}

.row-line {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-mark {
  flex: none;
  align-self: center;
  display: inline-block;
  margin: 0 6px 12px 0;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--brand);
  color: var(--brand);
  background: var(--surface);
  font-size: 10px;
  font-weight: 600;
}

.chat-row .attention-mark {
  margin: 0 6px 0 0;
}

.attention-mark.urgent {
  background: var(--brand);
  color: var(--on-brand);
}

.attention-notice {
  border-top: 3px solid var(--brand);
}

.attention-notice.urgent {
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
}

.attention-notice.urgent h3 {
  color: var(--error);
}

.unread-mark {
  flex: none;
  align-self: center;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 10px;
  font-weight: 600;
}

.list-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.list-pager:empty {
  display: none;
}

.list-pager button {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}

/* Columna central */
.inbox-chat {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  overflow: hidden;
}

.chat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.chat-head .who {
  flex: 1;
  min-width: 180px;
}

.chat-head .who p {
  font-size: 12px;
}

.chat-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.chat-actions button {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 12px;
}

.bot-status.compact {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 7px 12px;
  border-radius: 999px;
}

.bot-status.compact strong {
  font-size: 12px;
}

.inbox-chat #new-order-data {
  margin: 10px 20px 0;
}

.inbox-chat .messages {
  flex: 1;
  max-height: none;
  margin: 0;
  padding: 18px 20px;
  align-content: start;
  overscroll-behavior: contain;
}

.inbox-chat .bubble {
  max-width: 72%;
}

.inbox-chat .bubble.from-client {
  margin-right: auto;
  background: var(--surface);
}

.inbox-chat #jump-messages {
  align-self: center;
  margin: 6px 0;
  min-height: 36px;
  padding: 6px 14px;
  font-size: 12px;
}

.composer {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.composer textarea {
  grid-column: 1/-1;
  margin: 0;
  min-height: 60px;
  max-height: 30vh;
}

.composer .attach {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.composer .attach input {
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  margin: 0;
  padding: 4px;
  border: 0;
}

.composer-locked {
  flex: none;
  margin: 0;
  border-radius: 0;
  border-width: 1px 0 0;
  padding: 14px 20px;
}

.empty-state {
  margin: auto;
  max-width: 340px;
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  color: var(--ink);
  margin-bottom: 8px;
}

/* Columna derecha */
.inbox-side {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 4px 18px 24px;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.inbox-side>.empty-state {
  margin-top: 40px;
}

.inbox-side .detail-block {
  margin-top: 16px;
  padding-top: 16px;
}

.inbox-side>.detail-block:first-child {
  border-top: 0;
  margin-top: 8px;
}

.inbox-side h3 {
  font-size: 14px;
}

.inbox-side h4 {
  font-size: 12px;
  margin: 14px 0 4px;
}

.inbox-side label {
  margin: 10px 0;
}

.inbox-side input,.inbox-side select,.inbox-side textarea {
  max-width: 100%;
}

.inbox-side textarea {
  min-height: 76px;
}

.side-photo {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--gray-2);
  margin-bottom: 10px;
}

.quote-total {
  font: 600 22px/1.3 var(--font);
  margin-bottom: 6px;
}

.steps {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.steps li {
  position: relative;
  padding: 6px 0 6px 26px;
  font-size: 13px;
  color: var(--muted);
}

.steps li::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 11px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--surface);
}

.steps li::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 24px;
  bottom: -6px;
  width: 2px;
  background: var(--line);
}

.steps li:last-child::after {
  display: none;
}

.steps li.done {
  color: var(--ink);
}

.steps li.done::before {
  background: var(--ink);
  border-color: var(--ink);
}

.steps li.current {
  color: var(--ink);
  font-weight: 700;
}

.steps li.current::before {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--gray-3);
}

.reassign summary,.activity-log summary {
  cursor: pointer;
  min-height: 40px;
  padding: 8px 0;
  font-weight: 600;
  font-size: 13px;
}

.activity-log summary {
  font-size: 14px;
}

/* Escritorio angosto: la columna derecha baja debajo de la conversación */
@media(max-width:1100px) {
  .inbox {
    grid-template-columns: 280px minmax(0,1fr);
    grid-template-rows: minmax(0,62fr) minmax(0,38fr);
  }
  .inbox-list {
    grid-row: 1/-1;
  }
  .inbox-side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .inbox-chat .bubble {
    max-width: 85%;
  }
  .composer textarea {
    min-height: 48px;
  }
}

/* Celular: se conserva el diseño de tarjetas y el drawer, aunque quede la clase por un instante */
@media(max-width:760px) {
  body.inbox-mode {
    overflow: auto;
  }
  .inbox {
    display: block;
    height: auto;
  }
}

/* ===== 4.3: miniaturas de las fotos del cliente y Conversaciones (todas las medidas) ===== */
.thumb-btn {
  display: block;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  min-height: 0;
  cursor: zoom-in;
}

.thumb {
  display: block;
  width: 200px;
  max-width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 7px;
  background: var(--gray-1);
}

.thumb-private {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  white-space: normal;
}

.lightbox {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: 96vw;
  max-height: 92dvh;
  overflow: visible;
}

.lightbox::backdrop {
  background: rgba(20, 20, 20, .82);
}

.lightbox img {
  display: block;
  max-width: 96vw;
  max-height: 88dvh;
  border-radius: 8px;
  object-fit: contain;
}

.lightbox button {
  position: absolute;
  top: -14px;
  right: -6px;
  min-height: 36px;
  min-width: 36px;
  border-radius: 999px;
  background: var(--surface);
}

.back-btn,.side-head,.phone-bar {
  display: none;
}

/* ===== 4.3: celular (hasta 760 px). Un panel a la vez: lista → conversación → etapa y responsable ===== */
@media(max-width:760px) {
  body.inbox-mode .content {
    padding: 0;
  }
  .inbox {
    display: block;
    height: auto;
    background: var(--surface);
  }
  .inbox>section {
    display: none;
  }
  .inbox[data-pane=list] .inbox-list {
    display: flex;
    border-right: 0;
    overflow: visible;
  }
  .inbox-list .chat-list {
    overflow: visible;
  }
  .inbox[data-pane=chat] .inbox-chat,.inbox[data-pane=side] .inbox-side {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    height: 100dvh;
  }
  .inbox[data-pane=side] .inbox-side {
    display: block;
    overflow: auto;
    padding: 0 14px calc(24px + env(safe-area-inset-bottom));
    border: 0;
  }
  .back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    min-height: 40px;
    min-width: 40px;
    padding: 0;
    font-size: 20px;
    background: transparent;
    border-color: transparent;
  }
  .inbox-chat .chat-head {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 10px;
  }
  .inbox-chat .chat-head .avatar {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }
  .chat-head .who {
    min-width: 0;
  }
  .chat-head .who h2 {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .chat-head .who p {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .chat-head .bot-status.compact {
    margin-top: 4px;
    padding: 3px 9px;
  }
  .chat-head .bot-status.compact strong {
    font-size: 11px;
  }
  /* Mensajes a todo el ancho y burbujas compactas */
  .inbox-chat .messages {
    gap: 6px;
    padding: 10px 8px;
  }
  .inbox-chat .bubble {
    max-width: 88%;
    padding: 7px 10px;
    font-size: 14px;
    line-height: 1.35;
    border-radius: 10px;
  }
  .inbox-chat .bubble small {
    font-size: 10px;
    margin-bottom: 2px;
  }
  .inbox-chat .thumb {
    width: 180px;
    height: 135px;
  }
  .inbox-chat #new-order-data {
    margin: 8px 8px 0;
  }
  .composer {
    padding: 8px;
    gap: 6px 8px;
  }
  .composer textarea {
    min-height: 44px;
    font-size: 16px;
  }
  .composer-locked {
    padding: 10px 12px;
    font-size: 12px;
  }
  .phone-bar {
    flex: none;
    display: flex;
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .phone-bar button {
    flex: 1;
    min-height: 46px;
    padding: 8px 10px;
    font-size: 14px;
  }
  /* 4.27: estado del bot arriba de los botones de la barra */
  .phone-bar {
    flex-wrap: wrap;
  }
  .phone-bar .bot-status.compact {
    flex: 1 0 100%;
    justify-content: center;
    padding: 3px 9px;
  }
  .phone-bar .bot-status.compact strong {
    font-size: 12px;
  }
  .side-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 -14px 4px;
    padding: 8px 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  .side-head h2 {
    font-size: 16px;
  }
  .side-head p {
    font-size: 11px;
  }
  .side-actions {
    margin: 12px 0 0;
  }
  .inbox-side input,.inbox-side select,.inbox-side textarea {
    font-size: 16px;
  }
}

/* ===== 4.3.1: aviso flotante por encima de los paneles de celular (z-index 40) y error junto al botón de cotizar ===== */
.toast {
  z-index: 100;
}

.quote-error {
  margin: 8px 0 0;
  border-left: 3px solid var(--brand);
}

.quote-needs-model {
  margin: 0 0 8px;
  border-left: 3px solid var(--brand);
}

/* ===== 4.13: mensajes que llegaron con el bot pausado en la fábrica ===== */
.pause-mark {
  background: var(--warning-soft, #fff4d6);
  color: var(--warning-ink, #7a4b00);
}

.pause-tag {
  display: inline-block;
  margin: 2px 0 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--warning-soft, #fff4d6);
  color: var(--warning-ink, #7a4b00);
}

/* 4.14 entrega y cajas (notas/varios-modelos.md) */
.detail-block .boxes { margin-top: -2px; }
.detail-block .delivery-pending { color: var(--warning-ink, #7a4b00); font-weight: 600; }
.detail-block .delivery-ok { font-weight: 600; }
.delivery-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.delivery-form input[type="date"] { min-width: 0; flex: 1 1 150px; }
/* 4.35 (§7): la fecha lleva su etiqueta y no se ve como un cuadro vacío en el celular */
.delivery-form .delivery-date { display: flex; flex-direction: column; gap: 4px; flex: 1 1 170px; min-width: 0; font-weight: 600; }
.delivery-form .delivery-date input[type="date"] { width: 100%; min-height: 42px; font-weight: 400; }
/* 4.36 (notas/ajustes-4-36.md §3): dentro de la etiqueta (columna) el «flex: 1 1 150px» del campo se volvía ALTURA de 150 px en
   escritorio; ahora el campo tiene la altura normal y el botón queda alineado con él. */
.delivery-form { align-items: flex-end; }
.delivery-form .delivery-date input[type="date"] { flex: 0 0 auto; height: auto; }
.delivery-edit { margin-top: 8px; }
.delivery-edit > summary { cursor: pointer; font-weight: 600; color: var(--brand, #C8282D); }
.delivery-edit .delivery-change { margin-top: 8px; }
/* 4.35 (§6): «Cambiar solo la entrega» dentro del cambio pendiente */
.delivery-change { display: grid; gap: 8px; margin: 12px 0 8px; padding-top: 10px; border-top: 1px solid var(--line, #ddd); }
.delivery-change h4 { margin: 0; font-size: 1rem; }
.delivery-change .ent-domicilio { display: grid; gap: 8px; }
.delivery-change .ent-domicilio[hidden] { display: none; }

/* 4.18a dueño del cliente y toda la conversación (notas/ajustes-4-18a.md) */
.owner-mark { background: var(--gray-1); color: var(--ink); }
.owner-mark.owner-other, .owner-tag { background: var(--warning-soft, #fff4d6); color: var(--warning-ink, #7a4b00); }
.owner-tag { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; font-weight: 600; font-size: .85rem; }
.owner-line { font-weight: 600; }
.full-conv-bar { display: flex; justify-content: flex-end; padding: 4px 12px 0; }
.full-conv-btn { font-size: .85rem; }
.full-conv { width: min(720px, 96vw); max-height: 92dvh; padding: 0; border: 0; border-radius: 12px; background: var(--surface, #fff); color: inherit; display: flex; flex-direction: column; }
.full-conv:not([open]) { display: none; }
.full-conv::backdrop { background: rgba(20, 20, 20, .6); }
.full-conv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px 4px; }
.full-conv-head h2 { margin: 0; font-size: 1.1rem; }
.full-conv > .hint { margin: 0 16px 8px; }
.full-conv .messages { flex: 1; overflow-y: auto; padding: 8px 16px 16px; min-height: 200px; max-height: 76dvh; }
.full-conv .other-order { opacity: .72; }


/* 4.29 (notas/ajustes-4-29.md §6): otro pedido abierto del mismo cliente. */
.notice.other-orders { margin: 8px 0; padding: 10px 14px; }
.other-order-link { color: var(--brand, #C8282D); font-weight: 600; text-decoration: underline; }

/* 4.34 (notas/ajustes-4-34.md §1): por qué un botón está deshabilitado y el enlace al cuadro que lo destraba */
.disabled-why { margin: 6px 0 0; }
.link-button { min-height: 0; padding: 0; border: 0; background: none; color: var(--brand); text-decoration: underline; font: inherit; cursor: pointer; }
.flash { outline: 3px solid var(--brand); outline-offset: 2px; transition: outline-color .4s; }
.public-note { margin: 4px 0; }

/* ===== 4.37 (notas/ajustes-4-37.md): columna derecha del detalle en tarjetas (escritorio y celular, una debajo de otra) ===== */
.inbox-side.side-cards { background: var(--paper); }
.inbox-side .side-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 12px; margin-top: 12px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow-wrap: anywhere; }
.inbox-side .side-card:first-child, .inbox-side .side-head + .side-card, .inbox-side .side-actions + .side-card { margin-top: 10px; }
.side-card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.inbox-side .side-card .card-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; }
.card-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--gray-2); color: var(--ink); }
.card-count { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--gray-2); border-radius: 999px; padding: 2px 8px; }
.side-card p { margin: 4px 0; }
.state-pill { display: inline-block; white-space: nowrap; font-size: 12px; font-weight: 700; line-height: 1; padding: 5px 9px; border-radius: 999px; border: 1px solid transparent; }
.state-pill.info { color: #1d4ed8; background: #e8efff; border-color: #c7d6fb; }
.state-pill.ok { color: #166534; background: #e7f6ec; border-color: #b9e2c6; }
.state-pill.warn { color: #7a4b00; background: #fff3d1; border-color: #f0d38a; }
.state-pill.danger { color: #fff; background: var(--error); }
.state-pill.neutral { color: var(--muted); background: var(--gray-2); border-color: var(--line); }
/* Qué sigue */
.inbox-side .side-card.next-card { border-left: 4px solid #2563eb; }
.next-card .card-icon { background: #e8efff; color: #1d4ed8; }
.next-card .next-title { font-size: 17px; font-weight: 700; margin: 2px 0; }
.next-card .next-text { color: var(--muted); }
.next-card .go-link { margin-top: 6px; font-weight: 600; }
.next-card .next-alert { margin: 0; color: #7a4b00; }
.next-card .next-alert-text { font-weight: 600; }
.next-card .next-alert-text + .hint { margin-bottom: 8px; }
.next-card.attention-notice .next-title { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.next-card .next-bot { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.inbox-side .side-card.next-card.urgent { border-color: color-mix(in srgb, var(--error) 45%, var(--line)); border-left-color: var(--error); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.next-card.urgent .card-icon { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--error); }
.next-card.urgent .next-alert { color: var(--error); }
.inbox-side .side-card.attention-notice { border-top-width: 1px; }
.next-card .delivery-form { margin-top: 8px; }
/* Cambio pendiente: amarilla, roja si es urgente */
.inbox-side .side-card.change-notice { border-color: #f0d38a; border-left: 4px solid #d99a00; background: #fffaeb; }
.change-notice .card-icon { background: #fff0c2; color: #7a4b00; }
.inbox-side .side-card.change-notice.urgent { border-color: color-mix(in srgb, var(--error) 45%, var(--line)); border-left-color: var(--error); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.change-notice.urgent .card-icon { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--error); }
/* Productos */
.product-row { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.card-head + .product-row { border-top: 0; padding-top: 2px; }
.product-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--gray-2); display: block; }
.product-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.product-info strong { font-size: 14px; }
.product-meta { font-size: 13px; color: var(--muted); }
.product-m2 { text-align: right; white-space: nowrap; }
.product-m2 b { font-size: 22px; line-height: 1; margin-right: 3px; }
.product-m2 span { font-size: 13px; color: var(--muted); }
.product-m2.none span { font-size: 12px; }
/* Entrega */
.kv { display: grid; grid-template-columns: 118px minmax(0,1fr); gap: 8px; padding: 5px 0; align-items: baseline; }
.kv-k { font-size: 13px; color: var(--muted); }
.kv-v { font-size: 14px; }
.side-card .date-edit, .side-card .delivery-edit, .side-card .quote-history { margin-top: 8px; }
.side-card .date-edit > summary, .side-card .quote-history > summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 6px 0; }
/* Cotización */
.side-card .quote-total { font: 700 28px/1.2 var(--font); margin: 0; }
.side-card .quote-total.none { font-size: 16px; font-weight: 600; color: var(--muted); }
/* Etapa del pedido: barra de 6 pasos */
.stage-now { font-size: 14px; }
.steps.progress { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 8px 0 6px; }
.steps.progress li { padding: 0; height: 8px; border-radius: 999px; background: var(--gray-3); }
.steps.progress li::before, .steps.progress li::after { display: none; }
.steps.progress li.done { background: #16a34a; }
.steps.progress li.current { background: #2563eb; box-shadow: none; }
.stage-card .primary { margin-top: 4px; }
/* Actividad: cerrada por defecto */
.inbox-side .side-card.activity-log { padding-top: 8px; padding-bottom: 8px; }
.side-card.activity-log > summary { display: flex; align-items: center; gap: 8px; }
.side-card.activity-log > summary .card-count { margin-left: auto; }
@media(max-width:760px) {
  .inbox-side .side-card { padding: 12px; }
  .kv { grid-template-columns: 104px minmax(0,1fr); }
}
/* «Revisar datos del pedido» (editor de productos) con el mismo aspecto de tarjeta, debajo de «Productos» */
.inbox-side.side-cards > .order-editor { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; margin-top: 12px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.inbox-side.side-cards > .order-editor[open] { padding-bottom: 12px; }

/* ===== 4.38 (notas/ajustes-4-38.md §1): colores sobrios. Solo colores y bordes; espacios, tamaños y estructura de la 4.37 iguales. =====
   Ningún botón rojo: el principal gris oscuro y los demás blancos con borde fino. Rojo fuerte solo en el logo (PNG); rojo suave solo
   para lo urgente. Estados en pastillas suaves. */
:root {
  --brand: #2c2c2a;          /* antes el rojo de marca: ahora acentos, botón principal, marcas y enlaces en gris oscuro */
  --brand-hover: #444441;
  --on-brand: #ffffff;
  --error: #791f1f;
  --btn-line: #d6d2c8;
  --gris-bg: #f1efe8;   --gris-ink: #5f5e5a;
  --azul-bg: #e6f1fb;   --azul-ink: #0c447c;   --azul-linea: #85b7eb;  --azul-fondo: #f7fafd;
  --verde-bg: #eaf3de;  --verde-ink: #27500a;  --verde-paso: #639922;
  --ambar-bg: #faeeda;  --ambar-ink: #633806;  --ambar-linea: #fac775;
  --rojo-bg: #fcebeb;   --rojo-ink: #791f1f;   --rojo-linea: #f09595;
  --warning-soft: var(--ambar-bg);
  --warning-ink: var(--ambar-ink);
}
/* Botones */
button:where(:not(.primary,.pill,.chat-row,.nav,.link-button,.icon-btn)) { border-color: var(--btn-line); background-color: var(--surface); color: var(--ink); }
.primary, button.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.primary:hover:not(:disabled), button.primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
button.danger, .danger { color: var(--ink); }
.link-button, .other-order-link, .delivery-edit > summary { color: var(--ink); }
.flash { outline-color: var(--azul-linea); }
/* Filtros de la lista: el activo gris oscuro, los demás blancos con borde */
.pill { border-color: var(--btn-line); background: var(--surface); }
.pill:hover { background: var(--gris-bg); }
.pill.active { background: var(--brand); border-color: var(--brand); color: #ffffff; }
/* Pastillas de estado */
.state-pill { border-color: transparent; }
.state-pill.neutral { color: var(--gris-ink); background: var(--gris-bg); border-color: var(--gris-bg); }
.state-pill.info { color: var(--azul-ink); background: var(--azul-bg); border-color: var(--azul-bg); }
.state-pill.ok { color: var(--verde-ink); background: var(--verde-bg); border-color: var(--verde-bg); }
.state-pill.warn { color: var(--ambar-ink); background: var(--ambar-bg); border-color: var(--ambar-bg); }
.state-pill.danger { color: var(--rojo-ink); background: var(--rojo-bg); border-color: var(--rojo-bg); }
/* Bot activo: verde suave */
.bot-status.automatico { background: var(--verde-bg); border-color: var(--verde-bg); }
.bot-status.automatico strong { color: var(--verde-ink); }
/* Lista de solicitudes: pastilla de estado y aviso corto debajo del nombre */
.row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.row-bottom .row-line { min-width: 0; }
.row-bottom .row-state { flex: none; }
/* Título y pastilla de cada tarjeta: si la pastilla no cabe, baja de renglón (nunca parte el título) */
.side-card .card-head { flex-wrap: wrap; }
.inbox-side .side-card .card-head h3 { white-space: nowrap; }
.chat-row .row-state { font-size: 11px; }
.row-aviso { color: var(--ambar-ink); font-weight: 600; }
.row-aviso.urgent { color: var(--rojo-ink); background: var(--rojo-bg); border-left: 3px solid var(--rojo-linea); padding: 1px 6px; border-radius: 4px; justify-self: start; max-width: 100%; }
.chat-row.selected { box-shadow: inset 3px 0 var(--brand); }
/* Marcas y avisos de versiones anteriores (vista sin columna, Conversaciones) */
.attention-mark { border-color: var(--ambar-linea); color: var(--ambar-ink); background: var(--ambar-bg); }
.attention-mark.urgent { border-color: var(--rojo-linea); color: var(--rojo-ink); background: var(--rojo-bg); }
.attention-notice { border-top-color: var(--ambar-linea); }
.attention-notice.urgent { border-top-color: var(--rojo-linea); background: var(--rojo-bg); }
.attention-notice.urgent h3 { color: var(--rojo-ink); }
.quote-error { border-left-color: var(--rojo-linea); }
.quote-needs-model { border-left-color: var(--ambar-linea); }
.catalog-destacado { background: var(--ambar-bg); color: var(--ambar-ink); border-color: var(--ambar-linea); }
/* Qué sigue: línea izquierda azul suave y fondo muy claro (sin borde azul completo) */
.inbox-side .side-card.next-card { border-color: var(--line); border-left-color: var(--azul-linea); background: var(--azul-fondo); }
.next-card .card-icon { background: var(--azul-bg); color: var(--azul-ink); }
.next-card .next-alert { color: var(--ambar-ink); }
.inbox-side .side-card.next-card.urgent { border-color: var(--line); border-left-color: var(--rojo-linea); background: var(--rojo-bg); }
.next-card.urgent .card-icon { background: var(--surface); color: var(--rojo-ink); }
.next-card.urgent .next-alert { color: var(--rojo-ink); }
/* Cambio pendiente: ámbar suave; rojo suave si es urgente */
.inbox-side .side-card.change-notice { border-color: var(--line); border-left-color: var(--ambar-linea); background: #fdf8ef; }
.change-notice .card-icon { background: var(--ambar-bg); color: var(--ambar-ink); }
.inbox-side .side-card.change-notice.urgent { border-color: var(--line); border-left-color: var(--rojo-linea); background: var(--rojo-bg); }
.change-notice.urgent .card-icon { background: var(--surface); color: var(--rojo-ink); }
/* Etapa del pedido: hechos verde, actual azul suave, pendientes gris claro */
.steps.progress li { background: #e8e6df; }
.steps.progress li.done { background: var(--verde-paso); }
.steps.progress li.current { background: var(--azul-linea); }
/* Entrega: «Por confirmar» ámbar (state-pill.warn) y la fecha confirmada en verde (state-pill.ok) */
.detail-block .delivery-pending { color: var(--ambar-ink); }

/* ===== 4.39 (notas/ajustes-4-39.md). Mismos colores de la 4.38. ===== */
/* A1–A3: iniciales, fecha confirmada corta y «Nuevo» junto a la hora (ya no se encima con la línea del aviso). */
.chat-row .row-main { grid-template-columns: minmax(0,1fr); }
.chat-row .row-top strong { min-width: 0; }
.row-when { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.row-when .unread-mark { padding: 1px 6px; }
.kv-v .state-pill { white-space: nowrap; }

/* §B Entregas */
.entregas { display: grid; gap: 14px; }
.ent-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ent-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ent-week { font-size: 18px; margin: 0 4px; }
.ent-arrow { min-width: 40px; padding: 8px 10px; font-size: 16px; line-height: 1; }
.ent-hoy[aria-pressed="true"] { background: var(--gris-bg); }
.ent-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ent-filtro { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; }
.ent-filtro select { margin: 0; min-width: 190px; }
.ent-block { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.ent-block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ent-block-head h3 { margin: 0; font-size: 15px; }
.ent-block-head { flex-wrap: wrap; }
.ent-block-head .card-count, .ent-block-head .state-pill { white-space: nowrap; }
.ent-block .hint { margin: 2px 0 8px; }
.ent-sin.warn { border-left: 3px solid var(--ambar-linea); background: #fffdf8; }
.ent-day.today { border-left: 3px solid var(--azul-linea); background: var(--azul-fondo); }
.ent-empty { margin: 4px 0 2px; font-size: 12px; color: var(--muted); }
.ent-row { display: grid; grid-template-columns: minmax(150px,1.2fr) minmax(170px,1.6fr) minmax(150px,1.3fr) 158px minmax(90px,.7fr); gap: 12px; align-items: center;
  width: 100%; text-align: left; padding: 10px 6px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; min-height: 0; box-shadow: inset 0 1px var(--line); }
.ent-block-head + .ent-row, .ent-block .hint + .ent-row { box-shadow: none; }
.ent-row:hover { background: var(--gris-bg); }
.ent-row:focus-visible { outline: 2px solid var(--azul-linea); outline-offset: -2px; }
.ent-cliente, .ent-entrega { display: grid; gap: 1px; min-width: 0; }
.ent-cliente strong, .ent-prod, .ent-dir, .ent-vend { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ent-cliente strong { font-size: 13px; }
.ent-py, .ent-dir, .ent-vend { font-size: 12px; color: var(--muted); }
.ent-prod { font-size: 12px; }
.ent-entrega b { font-size: 12px; font-weight: 600; }
.ent-etapa { min-width: 0; }
.ent-etapa .state-pill { white-space: nowrap; }

/* §C Reportes */
.reportes { display: grid; gap: 14px; }
.reportes > *, .entregas > *, .rep-modelos > * { min-width: 0; }
.rep-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rep-periodos { display: flex; gap: 6px; flex-wrap: wrap; }
.rep-rango { margin: 0; }
.rep-stats { margin-bottom: 0; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 10px; }
.rep-tiempos { grid-template-columns: repeat(4,minmax(0,1fr)); }
.rep-stats .stat { padding: 14px; }
.rep-stats .stat strong { font-size: 26px; margin: 8px 0 2px; }
.rep-stats .stat small { display: block; font-size: 11px; line-height: 1.35; }
.rep-block { margin: 0; }
.rep-block .table-wrap td:first-child { font-weight: 600; }
.rep-modelos { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.rep-list { margin: 6px 0 0; padding-left: 22px; display: grid; gap: 2px; }
.rep-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.rep-list li:last-child { border-bottom: 0; }
.rep-list li > * { vertical-align: top; }
.rep-list li { display: list-item; }
.rep-list li .rep-model { display: inline-grid; gap: 0; width: calc(100% - 110px); }
.rep-list li .rep-num { display: inline-grid; justify-items: end; width: 104px; text-align: right; }
.rep-model strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-num b { font-size: 13px; }
.rep-nota { margin: 0; }

@media(max-width:1100px) {
  .ent-row { grid-template-columns: minmax(140px,1.2fr) minmax(150px,1.5fr) minmax(130px,1.2fr) 158px; }
  .ent-vend { display: none; }
  .rep-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .rep-tiempos { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:760px) {
  /* Celular: lista por día, una tarjeta por pedido */
  .ent-bar { display: grid; gap: 8px; }
  .ent-nav { display: grid; grid-template-columns: 40px 1fr 40px auto; align-items: center; }
  .ent-week { font-size: 15px; text-align: center; margin: 0; }
  .ent-tools { display: grid; grid-template-columns: 1fr; gap: 6px; }
  .ent-tools .card-count { justify-self: start; }
  .ent-filtro { display: grid; grid-template-columns: auto minmax(0,1fr); }
  .ent-filtro select { min-width: 0; width: 100%; }
  .ent-block { padding: 10px; }
  .ent-row { grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "cliente etapa" "prod prod" "entrega entrega" "vend vend"; gap: 4px 8px;
    border: 1px solid var(--btn-line); border-radius: 10px; box-shadow: none; padding: 10px 12px; margin-top: 8px; background: var(--surface); }
  .ent-block-head + .ent-row, .ent-block .hint + .ent-row { box-shadow: none; }
  .ent-cliente { grid-area: cliente; } .ent-etapa { grid-area: etapa; align-self: start; } .ent-prod { grid-area: prod; white-space: normal; }
  .ent-entrega { grid-area: entrega; grid-template-columns: auto minmax(0,1fr); gap: 6px; align-items: baseline; }
  .ent-dir { white-space: normal; }
  .ent-vend { grid-area: vend; display: block; }
  .rep-stats, .rep-tiempos { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .rep-stats .stat strong { font-size: 22px; }
  .rep-modelos { grid-template-columns: 1fr; }
}

/* ===== 4.40 (notas/ajustes-4-40.md): Entregas y Reportes apagadas. Etiqueta gris discreta en el menú (solo gerencia). ===== */
.nav .nav-soon {
  margin-left: auto;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
  white-space: nowrap;
}
.nav.soon { gap: 8px; padding-right: 6px; }
.nav.soon:not(.active) { color: var(--muted); }
.proximamente { min-height: 8px; }
@media (max-width: 760px) {
  .nav .nav-soon { margin-left: 5px; padding: 1px 5px; }
  .nav.soon { gap: 4px; padding-right: 11px; }
}
