/* =============================================================================
   MA Workflow — sistema visual (Sprint 4)
   1. Tokens   2. Base y layout   3. Componentes ma-*   4. Bootstrap ajustado
   5. Pantallas específicas (alcance, cotización, catálogo)   6. Responsive / movimiento
   El color tiene función: ámbar = acción, azul = espera/en curso, verde = resuelto,
   gris = neutro/histórico, rojo = error/rechazo/destructivo. Nunca solo color:
   siempre acompañado de texto y, cuando corresponde, icono.
   ========================================================================== */

/* 1. Tokens --------------------------------------------------------------- */
:root {
  --ma-brand: #0e4a5a;          /* petróleo: identidad */
  --ma-brand-ink: #0a3642;
  --ma-brand-soft: #e3eef1;
  --ma-accent: #1f6fd6;         /* azul vivo: acciones */
  --ma-accent-hover: #1759b0;
  --ma-accent-soft: #e8f1fc;
  --ma-focus: 0 0 0 3px rgba(31, 111, 214, .35);

  --ma-bg: #eef2f6;             /* fondo de aplicación */
  --ma-surface: #ffffff;        /* superficie principal */
  --ma-surface-2: #f6f8fb;      /* superficie secundaria */
  --ma-surface-edit: #f7f9fd;   /* campos editables */
  --ma-border: #dbe2ea;
  --ma-border-strong: #c3cdd8;

  --ma-text: #16202a;
  --ma-text-2: #3f4c59;
  --ma-text-3: #5b6875;         /* metadata (≥4.5:1 sobre blanco) */

  --ma-action-bg: #fff5db;   --ma-action-border: #f0c45c; --ma-action-ink: #6e4300; --ma-action-solid: #a86a00;
  --ma-wait-bg: #eaf2fd;     --ma-wait-border: #b8d2f4;   --ma-wait-ink: #154a8c;
  --ma-done-bg: #e7f5ec;     --ma-done-border: #acdcbd;   --ma-done-ink: #17643a;
  --ma-danger-bg: #fdecec;   --ma-danger-border: #efb4b4; --ma-danger-ink: #9b1f1f; --ma-danger-solid: #c42b2b;
  --ma-neutral-bg: #eef1f4;  --ma-neutral-border: #d6dde4; --ma-neutral-ink: #48545f;

  --ma-radius: 10px;
  --ma-radius-sm: 8px;
  --ma-radius-pill: 999px;
  --ma-shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 1px 3px rgba(16, 32, 48, .04);
  --ma-shadow-raised: 0 4px 14px rgba(16, 32, 48, .10);

  --ma-s1: 4px; --ma-s2: 8px; --ma-s3: 12px; --ma-s4: 16px; --ma-s5: 24px; --ma-s6: 32px; --ma-s7: 48px;
  --ma-maxw: 1320px;

  --ma-fs-page: 1.75rem;   /* 28px */
  --ma-fs-block: 1.125rem; /* 18px */
  --ma-fs-item: 0.9375rem; /* 15px */
  --ma-fs-body: 0.9375rem;
  --ma-fs-meta: 0.8125rem; /* 13px */
  --ma-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ma-ease: cubic-bezier(.2, .7, .3, 1);
}

/* 2. Base y layout -------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--ma-bg);
  color: var(--ma-text);
  font-family: var(--ma-font);
  font-size: var(--ma-fs-body);
  line-height: 1.55;
}
a { color: var(--ma-accent); text-underline-offset: 2px; }
a:hover { color: var(--ma-accent-hover); }
:focus-visible { outline: 2px solid var(--ma-accent); outline-offset: 2px; }
[id] { scroll-margin-top: 80px; }
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 { color: var(--ma-text); letter-spacing: -0.01em; }
.text-muted { color: var(--ma-text-3) !important; }
.small, small { font-size: var(--ma-fs-meta); }
code { color: var(--ma-brand); }

.ma-icon { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.2em; }
.ma-skip { position: absolute; left: -999px; top: 0; z-index: 2000; background: #fff; padding: 8px 12px; border-radius: 6px; }
.ma-skip:focus { left: 8px; top: 8px; }
.visually-hidden-focusable:not(:focus) { position: absolute !important; }

.ma-container { width: 100%; max-width: var(--ma-maxw); margin: 0 auto; padding: 0 var(--ma-s4); }
/* Aire bajo la navbar: 28 px desktop/tablet, 20 px mobile (ver media query <768). */
.ma-main { padding-top: 28px; padding-bottom: var(--ma-s7); }
.ma-narrow { max-width: 920px; }
/* Solo laterales: el shorthand "padding" anulaba el padding-top de .ma-main en desktop. */
@media (min-width: 992px) {
  .ma-container { padding-left: var(--ma-s6); padding-right: var(--ma-s6); }
  .ma-main { padding-bottom: 0; } /* conserva el espacio inferior actual de desktop */
}

/* Header */
.ma-header { background: var(--ma-brand); color: #fff; position: sticky; top: 0; z-index: 1030; }
.ma-header__inner { display: flex; align-items: center; gap: var(--ma-s4); min-height: 60px; position: relative; }
.ma-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.ma-brand:hover { color: #fff; }
.ma-brand__mark { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.16); display: grid; place-items: center; font-size: .78rem; letter-spacing: .02em; }
.ma-brand__sub { font-weight: 500; opacity: .75; }
.ma-nav { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ma-nav__link { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--ma-radius-sm); color: rgba(255,255,255,.85); text-decoration: none; font-weight: 500; background: transparent; border: 0; }
.ma-nav__link:hover, .ma-nav__link:focus-visible { color: #fff; background: rgba(255,255,255,.10); }
.ma-nav__link.is-active { color: #fff; background: rgba(255,255,255,.18); }
.ma-nav__count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--ma-radius-pill); background: var(--ma-action-border); color: #3d2600; font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }
.ma-header__end { margin-left: auto; display: flex; align-items: center; gap: var(--ma-s2); }
.ma-header .btn-cta { background: #fff; color: var(--ma-brand); border: 0; font-weight: 600; }
.ma-header .btn-cta:hover, .ma-header .btn-cta:focus-visible { background: var(--ma-brand-soft); color: var(--ma-brand-ink); }
.ma-user { display: flex; align-items: center; gap: 8px; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.28); border-radius: var(--ma-radius-pill); padding: 4px 10px 4px 4px; }
.ma-user:hover, .ma-user[aria-expanded="true"] { background: rgba(255,255,255,.10); color: #fff; }
.ma-user__avatar { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.ma-menu-toggle { display: none; color: #fff; background: transparent; border: 0; padding: 8px; border-radius: var(--ma-radius-sm); }
.ma-menu-toggle .ma-icon { width: 24px; height: 24px; }
.dropdown-menu { border: 1px solid var(--ma-border); border-radius: var(--ma-radius); box-shadow: var(--ma-shadow-raised); padding: 6px; font-size: var(--ma-fs-body); }
.dropdown-item { border-radius: 6px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; }
.dropdown-item:active, .dropdown-item.active { background: var(--ma-accent); }
.dropdown-header { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ma-text-3); }

/* 3. Componentes ---------------------------------------------------------- */

/* Encabezado de página */
.ma-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--ma-s3) var(--ma-s4); margin-bottom: var(--ma-s5); }
.ma-page-head__title { font-size: var(--ma-fs-page); font-weight: 700; line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
.ma-page-head__sub { color: var(--ma-text-2); margin: 6px 0 0; font-size: 1rem; }
.ma-page-head__actions { display: flex; flex-wrap: wrap; gap: var(--ma-s2); }
.ma-back { display: inline-flex; align-items: center; gap: 6px; font-size: var(--ma-fs-meta); font-weight: 500; text-decoration: none; margin-bottom: var(--ma-s2); color: var(--ma-text-2); }
.ma-back:hover { color: var(--ma-accent); }
.ma-eyebrow { font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ma-text-3); }

/* Secciones (cards) */
.ma-section { background: var(--ma-surface); border: 1px solid var(--ma-border); border-radius: var(--ma-radius); box-shadow: var(--ma-shadow); margin-bottom: var(--ma-s4); }
.ma-section__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ma-s2); padding: var(--ma-s4) var(--ma-s5) 0; }
.ma-section__title { font-size: var(--ma-fs-block); font-weight: 650; margin: 0; display: flex; align-items: center; gap: 8px; }
.ma-section__title .ma-icon { color: var(--ma-brand); }
.ma-section__meta { color: var(--ma-text-3); font-size: var(--ma-fs-meta); }
.ma-section__body { padding: var(--ma-s4) var(--ma-s5) var(--ma-s5); }
.ma-section__body--flush { padding: var(--ma-s3) 0 0; }
.ma-section__foot { padding: var(--ma-s3) var(--ma-s5); border-top: 1px solid var(--ma-border); font-size: var(--ma-fs-meta); }
.ma-section--muted { background: var(--ma-surface-2); box-shadow: none; }
.ma-section--action { border-color: var(--ma-action-border); border-top: 4px solid var(--ma-action-border); }
.ma-subsurface { background: var(--ma-surface-2); border: 1px solid var(--ma-border); border-radius: var(--ma-radius-sm); padding: var(--ma-s4); }
details.ma-section > summary { list-style: none; cursor: pointer; padding: var(--ma-s4) var(--ma-s5); display: flex; align-items: center; justify-content: space-between; gap: var(--ma-s2); font-weight: 650; }
details.ma-section > summary::-webkit-details-marker { display: none; }
details.ma-section > summary .ma-chevron { transition: transform .15s var(--ma-ease); }
details.ma-section[open] > summary .ma-chevron { transform: rotate(180deg); }
details.ma-section[open] > summary { border-bottom: 1px solid var(--ma-border); }

/* Tarjeta de contexto: qué pasa / quién tiene la acción / qué hacer */
.ma-context { display: flex; gap: var(--ma-s4); align-items: flex-start; padding: var(--ma-s5); border-radius: var(--ma-radius); border: 1px solid; margin-bottom: var(--ma-s4); }
.ma-context__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: rgba(255,255,255,.75); }
.ma-context__icon .ma-icon { width: 22px; height: 22px; }
.ma-context__body { flex: 1; min-width: 0; }
.ma-context__label { font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; margin-bottom: 2px; }
.ma-context__title { font-size: 1.25rem; font-weight: 700; margin: 0 0 4px; color: inherit; }
.ma-context__text { margin: 0; color: var(--ma-text-2); }
.ma-context__actions { display: flex; flex-wrap: wrap; gap: var(--ma-s2); margin-top: var(--ma-s4); }
.ma-context--action { background: var(--ma-action-bg); border-color: var(--ma-action-border); color: var(--ma-action-ink); }
.ma-context--action .ma-context__icon { color: var(--ma-action-solid); }
.ma-context--waiting, .ma-context--progress { background: var(--ma-wait-bg); border-color: var(--ma-wait-border); color: var(--ma-wait-ink); }
.ma-context--done { background: var(--ma-done-bg); border-color: var(--ma-done-border); color: var(--ma-done-ink); }
.ma-context--neutral { background: var(--ma-neutral-bg); border-color: var(--ma-neutral-border); color: var(--ma-neutral-ink); }
.ma-context--danger { background: var(--ma-danger-bg); border-color: var(--ma-danger-border); color: var(--ma-danger-ink); }

/* Píldoras de estado */
.ma-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--ma-radius-pill); font-size: .78rem; font-weight: 600; line-height: 1.4; border: 1px solid transparent; white-space: nowrap; }
.ma-pill .ma-icon { width: 14px; height: 14px; }
.ma-pill--action { background: var(--ma-action-bg); color: var(--ma-action-ink); border-color: var(--ma-action-border); }
.ma-pill--waiting, .ma-pill--progress { background: var(--ma-wait-bg); color: var(--ma-wait-ink); border-color: var(--ma-wait-border); }
.ma-pill--done { background: var(--ma-done-bg); color: var(--ma-done-ink); border-color: var(--ma-done-border); }
.ma-pill--danger { background: var(--ma-danger-bg); color: var(--ma-danger-ink); border-color: var(--ma-danger-border); }
.ma-pill--neutral { background: var(--ma-neutral-bg); color: var(--ma-neutral-ink); border-color: var(--ma-neutral-border); }
.ma-tag { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 600; color: var(--ma-text-3); background: var(--ma-surface-2); border: 1px solid var(--ma-border); padding: 1px 8px; border-radius: var(--ma-radius-pill); }

/* Resumen lateral */
.ma-summary { background: var(--ma-surface); border: 1px solid var(--ma-border); border-radius: var(--ma-radius); box-shadow: var(--ma-shadow); margin-bottom: var(--ma-s4); }
.ma-summary__head { padding: var(--ma-s4) var(--ma-s4) 0; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.ma-summary__list { margin: 0; padding: var(--ma-s3) var(--ma-s4) var(--ma-s4); }
.ma-summary__row { display: flex; justify-content: space-between; gap: var(--ma-s3); padding: 8px 0; border-bottom: 1px solid var(--ma-border); }
.ma-summary__row:last-child { border-bottom: 0; }
.ma-summary__row dt { font-weight: 500; color: var(--ma-text-3); font-size: var(--ma-fs-meta); }
.ma-summary__row dd { margin: 0; text-align: right; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.ma-summary__actions { padding: 0 var(--ma-s4) var(--ma-s4); display: grid; gap: var(--ma-s2); }
@media (min-width: 992px) { .ma-sticky { position: sticky; top: 84px; } }

/* Indicadores compactos (cliqueables) */
.ma-indicators { display: flex; flex-wrap: wrap; gap: var(--ma-s3); margin-bottom: var(--ma-s5); }
.ma-indicator { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--ma-surface); border: 1px solid var(--ma-border); border-radius: var(--ma-radius); box-shadow: var(--ma-shadow); text-decoration: none; color: var(--ma-text); min-width: 170px; }
.ma-indicator:hover { border-color: var(--ma-border-strong); color: var(--ma-text); box-shadow: var(--ma-shadow-raised); }
.ma-indicator__value { font-size: 1.5rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.ma-indicator__label { font-size: var(--ma-fs-meta); color: var(--ma-text-2); font-weight: 500; }
.ma-indicator--action { border-color: var(--ma-action-border); background: var(--ma-action-bg); }
.ma-indicator--action .ma-indicator__value { color: var(--ma-action-solid); }
.ma-indicator--waiting .ma-indicator__value { color: var(--ma-wait-ink); }

/* Listas de pedidos / elementos */
.ma-list { list-style: none; margin: 0; padding: 0; }
.ma-item { display: flex; gap: var(--ma-s4); align-items: flex-start; padding: var(--ma-s4) var(--ma-s5); border-top: 1px solid var(--ma-border); transition: background-color .15s var(--ma-ease); }
.ma-item:first-child { border-top: 0; }
.ma-item:hover { background: var(--ma-surface-2); }
.ma-item__icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--ma-neutral-bg); color: var(--ma-neutral-ink); }
.ma-item__icon--action { background: var(--ma-action-bg); color: var(--ma-action-solid); }
.ma-item__icon--waiting, .ma-item__icon--progress { background: var(--ma-wait-bg); color: var(--ma-wait-ink); }
.ma-item__icon--done { background: var(--ma-done-bg); color: var(--ma-done-ink); }
.ma-item__icon--danger { background: var(--ma-danger-bg); color: var(--ma-danger-ink); }
.ma-item__body { flex: 1; min-width: 0; }
.ma-item__title { font-weight: 650; font-size: var(--ma-fs-item); margin: 0; color: var(--ma-text); text-decoration: none; overflow-wrap: anywhere; }
a.ma-item__title:hover { color: var(--ma-accent); text-decoration: underline; }
.ma-item__why { margin: 2px 0 0; color: var(--ma-text-2); }
.ma-item__why strong { color: var(--ma-text); }
.ma-item__meta { margin-top: 4px; color: var(--ma-text-3); font-size: var(--ma-fs-meta); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.ma-item__aside { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.ma-item.is-muted .ma-item__title { color: var(--ma-text-2); }

/* Estado vacío compacto */
.ma-empty { display: flex; align-items: center; gap: 10px; padding: var(--ma-s4) var(--ma-s5); color: var(--ma-text-2); margin: 0; }
.ma-empty .ma-icon { color: var(--ma-text-3); }
.ma-empty--ok { background: var(--ma-done-bg); color: var(--ma-done-ink); border: 1px solid var(--ma-done-border); border-radius: var(--ma-radius); font-weight: 500; }
.ma-empty--ok .ma-icon { color: var(--ma-done-ink); }
.ma-empty--inline { padding: 0; color: var(--ma-text-3); }

/* Actividad */
.ma-activity { list-style: none; margin: 0; padding: 0; }
.ma-activity__item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ma-border); }
.ma-activity__item:last-child { border-bottom: 0; }
.ma-activity__icon { width: 30px; height: 30px; border-radius: 50%; background: var(--ma-surface-2); border: 1px solid var(--ma-border); display: grid; place-items: center; color: var(--ma-brand); flex-shrink: 0; }
.ma-activity__icon .ma-icon { width: 15px; height: 15px; }
.ma-activity__body { min-width: 0; }
.ma-activity__text { color: var(--ma-text); overflow-wrap: anywhere; }
.ma-activity__meta { color: var(--ma-text-3); font-size: var(--ma-fs-meta); }

/* Tarjetas seleccionables */
.ma-choices { display: grid; gap: var(--ma-s3); grid-template-columns: 1fr; }
@media (min-width: 768px) { .ma-choices--2 { grid-template-columns: 1fr 1fr; } }
.ma-choice { position: relative; display: flex; gap: var(--ma-s4); align-items: flex-start; padding: var(--ma-s5); background: var(--ma-surface); border: 2px solid var(--ma-border); border-radius: var(--ma-radius); text-decoration: none; color: var(--ma-text); cursor: pointer; transition: border-color .15s var(--ma-ease), box-shadow .15s var(--ma-ease), background-color .15s; min-height: 44px; margin: 0; }
a.ma-choice:hover, label.ma-choice:hover { border-color: var(--ma-accent); color: var(--ma-text); box-shadow: var(--ma-shadow-raised); }
.ma-choice__icon { width: 48px; height: 48px; border-radius: 12px; background: var(--ma-brand-soft); color: var(--ma-brand); display: grid; place-items: center; flex-shrink: 0; }
.ma-choice__icon .ma-icon { width: 24px; height: 24px; }
.ma-choice__body { flex: 1; min-width: 0; }
.ma-choice__title { font-size: 1.1rem; font-weight: 700; margin: 0 0 4px; }
.ma-choice__text { color: var(--ma-text-2); margin: 0; }
.ma-choice__go { margin-top: var(--ma-s3); color: var(--ma-accent); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.ma-choice--compact { padding: var(--ma-s4); }
.ma-choice--compact .ma-choice__icon { width: 38px; height: 38px; }
.ma-choice--compact .ma-choice__title { font-size: 1rem; }
/* Selección con radio (estado selected inequívoco: borde, fondo y tilde) */
.ma-choice-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.ma-choice__check { margin-left: auto; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ma-border-strong); display: grid; place-items: center; flex-shrink: 0; color: transparent; background: #fff; }
.ma-choice__check .ma-icon { width: 14px; height: 14px; }
.ma-choice-input:checked + .ma-choice { border-color: var(--ma-accent); background: var(--ma-accent-soft); }
.ma-choice-input:checked + .ma-choice .ma-choice__check { background: var(--ma-accent); border-color: var(--ma-accent); color: #fff; }
.ma-choice-input:focus-visible + .ma-choice { outline: 2px solid var(--ma-accent); outline-offset: 2px; }

/* Formularios por bloques */
.ma-form-section { padding: var(--ma-s5); border-top: 1px solid var(--ma-border); }
.ma-form-section:first-child { border-top: 0; }
.ma-form-section__title { font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ma-brand); margin: 0 0 var(--ma-s3); }
.ma-optional { font-weight: 400; color: var(--ma-text-3); font-size: var(--ma-fs-meta); }
.ma-form-actions { display: flex; flex-wrap: wrap; gap: var(--ma-s2); align-items: center; }

/* Live */
.ma-live { display: inline-flex; align-items: center; gap: 6px; font-size: var(--ma-fs-meta); color: var(--ma-text-3); }
.ma-live__dot { width: 8px; height: 8px; border-radius: 50%; background: #2e9e5b; }
.ma-live.is-stale .ma-live__dot { background: var(--ma-border-strong); }
[data-live-region].is-updated { animation: ma-flash 1.6s var(--ma-ease); }
@keyframes ma-flash { from { background-color: var(--ma-action-bg); } to { background-color: transparent; } }

/* Diálogo de confirmación integrado */
.ma-dialog { border: 0; border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(10, 30, 50, .25); color: var(--ma-text); }
.ma-dialog::backdrop { background: rgba(10, 30, 45, .45); }
.ma-dialog__body { padding: var(--ma-s5) var(--ma-s5) var(--ma-s3); }
.ma-dialog__title { font-size: 1.1rem; font-weight: 700; margin: 0 0 6px; }
.ma-dialog__text { margin: 0; color: var(--ma-text-2); white-space: pre-line; }
.ma-dialog__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--ma-s2); padding: var(--ma-s3) var(--ma-s5) var(--ma-s5); }

/* Barra de progreso */
.ma-progress { height: 8px; border-radius: 999px; background: var(--ma-neutral-bg); overflow: hidden; }
.ma-progress__bar { height: 100%; background: var(--ma-accent); border-radius: 999px; transition: width .3s var(--ma-ease); }
.ma-progress.is-complete .ma-progress__bar { background: var(--ma-done-ink); }

/* Total protagonista (cotización) */
.ma-total { background: var(--ma-brand); color: #fff; border-radius: var(--ma-radius); padding: var(--ma-s4) var(--ma-s5); }
.ma-total__label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; font-weight: 600; }
.ma-total__value { font-size: 1.9rem; font-weight: 750; line-height: 1.15; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ma-total__sub { font-size: var(--ma-fs-meta); opacity: .9; }
.ma-amounts { width: 100%; margin-bottom: var(--ma-s3); }
.ma-amounts th { font-weight: 500; color: var(--ma-text-3); padding: 6px 0; }
.ma-amounts td { text-align: right; padding: 6px 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Archivos */
.ma-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--ma-border); border-radius: var(--ma-radius-sm); background: var(--ma-surface); margin-bottom: 8px; }
.ma-file:last-child { margin-bottom: 0; }
.ma-file__icon { width: 34px; height: 34px; border-radius: 8px; background: var(--ma-brand-soft); color: var(--ma-brand); display: grid; place-items: center; flex-shrink: 0; }
.ma-file__body { flex: 1; min-width: 0; }
.ma-file__name { font-weight: 600; overflow-wrap: anywhere; }
.ma-file__meta { color: var(--ma-text-3); font-size: var(--ma-fs-meta); }

/* Entregas */
.ma-deliverable { border: 1px solid var(--ma-border); border-radius: var(--ma-radius); padding: var(--ma-s4); margin-bottom: var(--ma-s3); background: var(--ma-surface); }
.ma-deliverable.is-current { border-color: var(--ma-border-strong); box-shadow: var(--ma-shadow); }
.ma-deliverable.is-action { border-color: var(--ma-action-border); }
.ma-deliverable__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ma-s2); }
.ma-deliverable__title { font-weight: 650; margin: 0; overflow-wrap: anywhere; }

/* Comentarios */
.ma-comment { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--ma-border); }
.ma-comment:first-child { border-top: 0; padding-top: 0; }
.ma-comment__avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ma-neutral-bg); color: var(--ma-neutral-ink); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.ma-comment__avatar.is-team { background: var(--ma-brand); color: #fff; }
.ma-comment__body { min-width: 0; flex: 1; }
.ma-comment__head { font-size: var(--ma-fs-meta); color: var(--ma-text-3); }
.ma-comment__head strong { color: var(--ma-text); }
.ma-comment__text { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

/* Login */
.ma-login { flex: 1 0 auto; display: grid; place-items: center; padding: var(--ma-s5) var(--ma-s4); background: linear-gradient(180deg, var(--ma-brand) 0, var(--ma-brand) 150px, var(--ma-bg) 150px); }
.ma-login__card { width: 100%; max-width: 400px; background: var(--ma-surface); border-radius: 14px; box-shadow: var(--ma-shadow-raised); padding: var(--ma-s6) var(--ma-s5); }
.ma-login__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--ma-brand); margin-bottom: var(--ma-s5); }
.ma-login__brand .ma-brand__mark { background: var(--ma-brand); color: #fff; }

/* 4. Bootstrap ajustado -------------------------------------------------- */
.card { border: 1px solid var(--ma-border); border-radius: var(--ma-radius); box-shadow: var(--ma-shadow) !important; }
.card-header, .card-footer { background: var(--ma-surface-2) !important; border-color: var(--ma-border); }
.btn { font-weight: 600; border-radius: var(--ma-radius-sm); padding: .5rem 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.35; }
.btn-sm { padding: .35rem .7rem; font-size: .84rem; }
.btn-lg { padding: .7rem 1.3rem; font-size: 1rem; }
.btn-primary { background: var(--ma-accent); border-color: var(--ma-accent); }
.btn-primary:hover, .btn-primary:focus { background: var(--ma-accent-hover); border-color: var(--ma-accent-hover); }
.btn-success { background: #1d7a46; border-color: #1d7a46; }
.btn-success:hover, .btn-success:focus { background: #17643a; border-color: #17643a; }
.btn-outline-primary { color: var(--ma-accent-hover); border-color: var(--ma-border-strong); background: var(--ma-surface); }
.btn-outline-primary:hover, .btn-outline-primary:focus { background: var(--ma-accent-soft); color: var(--ma-accent-hover); border-color: var(--ma-accent); }
.btn-outline-secondary { color: var(--ma-text-2); border-color: var(--ma-border-strong); background: var(--ma-surface); }
.btn-outline-secondary:hover, .btn-outline-secondary:focus { background: var(--ma-surface-2); color: var(--ma-text); border-color: var(--ma-border-strong); }
.btn-outline-danger { color: var(--ma-danger-ink); border-color: var(--ma-danger-border); background: var(--ma-surface); }
.btn-outline-danger:hover, .btn-outline-danger:focus { background: var(--ma-danger-bg); color: var(--ma-danger-ink); border-color: var(--ma-danger-solid); }
.btn-danger { background: var(--ma-danger-solid); border-color: var(--ma-danger-solid); }
.btn-warning { color: #3d2600; background: var(--ma-action-border); border-color: var(--ma-action-border); }
.btn-outline-warning { background: var(--ma-surface); color: var(--ma-action-ink); border-color: var(--ma-action-border); }
.btn-outline-warning:hover, .btn-warning:hover { background: #e7b53f; border-color: #e7b53f; color: #3d2600; }
.btn-outline-success { color: var(--ma-done-ink); border-color: var(--ma-done-border); background: var(--ma-surface); }
.btn-outline-success:hover, .btn-outline-success:focus { background: var(--ma-done-bg); color: var(--ma-done-ink); border-color: var(--ma-done-ink); }
.btn-outline-info { color: var(--ma-wait-ink); border-color: var(--ma-wait-border); background: var(--ma-surface); }
.btn-outline-info:hover { background: var(--ma-wait-bg); color: var(--ma-wait-ink); }
.btn-link { font-weight: 500; text-decoration: none; }
.btn-tertiary { background: transparent; border-color: transparent; color: var(--ma-accent-hover); font-weight: 600; }
.btn-tertiary:hover, .btn-tertiary:focus { background: var(--ma-accent-soft); color: var(--ma-accent-hover); }
.btn-tertiary-danger { background: transparent; border-color: transparent; color: var(--ma-danger-ink); font-weight: 500; }
.btn-tertiary-danger:hover, .btn-tertiary-danger:focus { background: var(--ma-danger-bg); color: var(--ma-danger-ink); }
.btn:focus-visible { box-shadow: var(--ma-focus); outline: none; }
.btn:disabled, .btn.disabled { opacity: .55; }
.btn.is-busy { pointer-events: none; opacity: .75; }

.form-label { font-weight: 600; color: var(--ma-text); margin-bottom: 6px; font-size: .9rem; }
.form-text { color: var(--ma-text-3); font-size: var(--ma-fs-meta); }
.form-control, .form-select { background-color: var(--ma-surface-edit); border: 1px solid var(--ma-border-strong); border-radius: var(--ma-radius-sm); padding: .55rem .8rem; color: var(--ma-text); min-height: 44px; }
.form-control-sm, .form-select-sm { min-height: 36px; padding: .35rem .6rem; }
.form-control:hover, .form-select:hover { border-color: #a9b6c4; }
.form-control:focus, .form-select:focus { background-color: #fff; border-color: var(--ma-accent); box-shadow: var(--ma-focus); }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--ma-neutral-bg); color: var(--ma-text-3); }
.form-control.is-invalid, .form-select.is-invalid, .was-validated .form-control:invalid { border-color: var(--ma-danger-solid); background-image: none; }
.invalid-feedback { color: var(--ma-danger-ink); font-weight: 500; }
.form-check-input { width: 1.15em; height: 1.15em; border-color: var(--ma-border-strong); }
.form-check-input:checked { background-color: var(--ma-accent); border-color: var(--ma-accent); }
.form-control-plaintext { color: var(--ma-text); }
textarea.form-control { min-height: 88px; }
.input-group-text { background: var(--ma-surface-2); border-color: var(--ma-border-strong); }

.alert { border-radius: var(--ma-radius); border-width: 1px; }
.alert-warning { background: var(--ma-action-bg); border-color: var(--ma-action-border); color: var(--ma-action-ink); }
.alert-info, .alert-primary { background: var(--ma-wait-bg); border-color: var(--ma-wait-border); color: var(--ma-wait-ink); }
.alert-success { background: var(--ma-done-bg); border-color: var(--ma-done-border); color: var(--ma-done-ink); }
.alert-danger { background: var(--ma-danger-bg); border-color: var(--ma-danger-border); color: var(--ma-danger-ink); }
.alert-secondary, .alert-light { background: var(--ma-surface-2); border-color: var(--ma-border); color: var(--ma-text-2); }
.ma-flash { display: flex; gap: 10px; align-items: flex-start; }
.ma-flash .ma-icon { margin-top: 3px; }

.badge { font-weight: 600; border-radius: var(--ma-radius-pill); padding: .35em .7em; }
.text-bg-success { background: var(--ma-done-bg) !important; color: var(--ma-done-ink) !important; }
.text-bg-warning { background: var(--ma-action-bg) !important; color: var(--ma-action-ink) !important; }
.text-bg-info { background: var(--ma-wait-bg) !important; color: var(--ma-wait-ink) !important; }
.text-bg-secondary, .text-bg-light { background: var(--ma-neutral-bg) !important; color: var(--ma-neutral-ink) !important; }
.text-bg-danger { background: var(--ma-danger-bg) !important; color: var(--ma-danger-ink) !important; }
.text-bg-primary { background: var(--ma-accent-soft) !important; color: var(--ma-accent-hover) !important; }
.text-bg-dark { background: var(--ma-brand) !important; color: #fff !important; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .75rem 1rem; border-color: var(--ma-border); }
.table thead th { font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ma-text-3); font-weight: 600; background: var(--ma-surface-2); }
.table-hover > tbody > tr:hover > * { --bs-table-accent-bg: var(--ma-surface-2); }
.table td, .table th { vertical-align: middle; }
.table-light { --bs-table-bg: var(--ma-surface-2); }

.nav-pills .nav-link { color: var(--ma-text-2); border-radius: var(--ma-radius-pill); font-weight: 500; }
.nav-pills .nav-link.active { background: var(--ma-brand); }
.list-group-item { border-color: var(--ma-border); }
.ma-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--ma-s4); }
.ma-filter { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; min-height: 36px; border-radius: var(--ma-radius-pill); border: 1px solid var(--ma-border-strong); background: var(--ma-surface); color: var(--ma-text-2); font-weight: 500; text-decoration: none; }
.ma-filter:hover { border-color: var(--ma-accent); color: var(--ma-accent-hover); }
.ma-filter.is-active { background: var(--ma-brand); border-color: var(--ma-brand); color: #fff; }
.ma-filter__count { font-size: .75rem; opacity: .8; }

/* Acordeón (genérico) */
.accordion { --bs-accordion-border-color: var(--ma-border); --bs-accordion-border-radius: var(--ma-radius); --bs-accordion-inner-border-radius: var(--ma-radius); --bs-accordion-btn-focus-box-shadow: var(--ma-focus); --bs-accordion-active-bg: var(--ma-surface-2); --bs-accordion-active-color: var(--ma-text); }

/* 5. Pantallas específicas ----------------------------------------------- */

/* Constructor de alcance — NIVEL 1: stepper */
.scope-builder { max-width: 920px; }
.scope-kicker { letter-spacing: .07em; font-size: .72rem; font-weight: 700; }
.scope-steps { display: flex; gap: var(--ma-s2); }
.scope-step { flex: 1; background: var(--ma-surface); border: 1px solid var(--ma-border); border-radius: var(--ma-radius); padding: 10px 14px; color: var(--ma-text-3); font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.scope-step a { display: flex; align-items: center; gap: 8px; }
.scope-step-num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ma-neutral-bg); font-weight: 700; flex-shrink: 0; margin-right: 0; }
.scope-step.is-current { border-color: var(--ma-accent); color: var(--ma-text); font-weight: 650; box-shadow: inset 0 -3px 0 var(--ma-accent); }
.scope-step.is-current .scope-step-num { background: var(--ma-accent); color: #fff; }
.scope-step.is-done { color: var(--ma-done-ink); }
.scope-step.is-done .scope-step-num { background: var(--ma-done-bg); color: var(--ma-done-ink); }
@media (max-width: 575.98px) { .scope-step:not(.is-current) .scope-step-label { display: none; } .scope-step { flex: 0 0 auto; } .scope-step.is-current { flex: 1; } }

/* NIVEL 2: categoría = cabecera estructural */
.scope-accordion { display: flex; flex-direction: column; gap: var(--ma-s3); }
.scope-accordion .accordion-item { border: 1px solid var(--ma-border) !important; border-radius: var(--ma-radius) !important; overflow: hidden; background: var(--ma-surface); box-shadow: var(--ma-shadow); }
.scope-accordion .accordion-button { background: var(--ma-brand-soft); color: var(--ma-brand-ink); padding: 14px 18px; gap: 12px; box-shadow: none; min-height: 56px; }
.scope-accordion .accordion-button:not(.collapsed) { background: var(--ma-brand); color: #fff; box-shadow: none; }
.scope-accordion .accordion-button:not(.collapsed)::after { filter: brightness(0) invert(1); }
.scope-accordion .accordion-button .flex-fill { font-size: .95rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.scope-progress { background: rgba(255,255,255,.85); color: var(--ma-brand-ink); font-weight: 600; border: 1px solid rgba(14,74,90,.15); }
.scope-progress.is-complete { background: var(--ma-done-bg); color: var(--ma-done-ink); border-color: var(--ma-done-border); }

/* NIVEL 3: servicio */
.scope-service { padding: 16px 18px 16px 22px; border-bottom: 1px solid var(--ma-border); border-left: 4px solid transparent; transition: background-color .15s; }
.scope-service .fw-semibold { font-size: var(--ma-fs-item); }
.scope-service.is-yes { border-left-color: #1d7a46; background: #f3faf6; }
.scope-service.is-no { border-left-color: var(--ma-border-strong); }
.scope-service.has-error, .show-pending .scope-service.is-undecided { border-left-color: var(--ma-danger-solid); background: #fff7f7; }
.scope-question { color: var(--ma-text-2); }
.scope-pending { display: none; color: var(--ma-danger-ink); font-weight: 500; }
.show-pending .scope-service.is-undecided .scope-pending { display: block; }
.scope-errors { color: var(--ma-danger-ink); padding-left: 1.1rem; }
.scope-decision .btn { min-width: 6rem; min-height: 44px; }
.scope-entry-note { color: var(--ma-text-2); }
/* NIVEL 4: campos del servicio solicitado (subordinados) */
.scope-fields { margin: 14px 0 2px 8px; padding: 16px; border: 0; border-left: 3px solid #b5dfc6; background: var(--ma-surface); border-radius: 0 var(--ma-radius-sm) var(--ma-radius-sm) 0; min-width: 0; }
.scope-category-footer { padding: 12px 18px; background: var(--ma-surface-2); }
.scope-bottom-bar { position: sticky; bottom: 12px; z-index: 10; overflow: hidden; margin-top: var(--ma-s4); border-radius: var(--ma-radius) !important; box-shadow: var(--ma-shadow-raised) !important; }
.scope-overall { position: sticky; top: 60px; z-index: 20; background: var(--ma-bg); padding: 10px 0; margin-bottom: var(--ma-s3); }

/* Resumen / vista del alcance */
.scope-badge-yes { background: var(--ma-done-bg); color: var(--ma-done-ink); }
.scope-badge-no { background: var(--ma-neutral-bg); color: var(--ma-neutral-ink); }
.scope-mark { font-weight: 700; width: 1.25rem; flex-shrink: 0; }
.scope-mark-yes { color: #1d7a46; }
.scope-mark-no { color: #8b97a3; }
.scope-item-no { color: var(--ma-text-3); background: var(--ma-surface-2); }
.scope-event-data dt { font-weight: 500; color: var(--ma-text-3); }

/* Diff entre versiones */
.scope-diff-mark { display: inline-block; width: 1rem; font-weight: 700; }
.scope-diff { border-top: 4px solid var(--ma-accent) !important; }
.scope-diff-group { border-left: 4px solid var(--ma-border); padding: 4px 0 4px 14px; }
.scope-diff-group--success { border-left-color: #1d7a46; }
.scope-diff-group--danger { border-left-color: var(--ma-danger-solid); }
.scope-diff-group--primary { border-left-color: var(--ma-accent); }
.scope-diff .text-success { color: var(--ma-done-ink) !important; }
.scope-diff .text-danger { color: var(--ma-danger-ink) !important; }
.scope-diff .text-primary { color: var(--ma-accent-hover) !important; }
.scope-diff-old { color: var(--ma-text-3); text-decoration: line-through; }
.scope-diff-new { font-weight: 650; }

/* Cotización */
.quotation-amounts th, .quotation-amounts td { border-color: var(--ma-border); }

/* Compatibilidad con marcas anteriores */
.table-wrap { border-radius: var(--ma-radius); }
.status-badge { font-size: .75rem; }
.timeline { border-left: 3px solid var(--ma-border); padding-left: 1rem; }
.timeline-item { position: relative; margin-bottom: 1rem; }
.timeline-item::before { content: ""; position: absolute; left: -1.45rem; top: .35rem; width: .75rem; height: .75rem; background: var(--ma-accent); border-radius: 50%; }
.client-action { min-height: 72px; font-size: 1.05rem; font-weight: 700; }
.notify-row-attention > td { background: var(--ma-action-bg); }
.notify-news .notify-important { border-left: 3px solid var(--ma-action-border); padding-left: .5rem; }
.intent-option { border-width: 2px; }
.project-suggestion { color: var(--ma-action-ink); }
.catalog-inactive > td:not(:last-child) { opacity: .55; }
.request-type-card { border: 2px solid transparent; }
.request-type-icon { font-size: 2rem; line-height: 1; }

/* 6. Responsive / movimiento --------------------------------------------- */
@media (max-width: 991.98px) {
  .ma-menu-toggle { display: inline-flex; }
  .ma-header__nav { display: none; position: absolute; left: calc(-1 * var(--ma-s4)); right: calc(-1 * var(--ma-s4)); top: 60px; background: var(--ma-brand-ink); padding: var(--ma-s3) var(--ma-s4) var(--ma-s4); box-shadow: var(--ma-shadow-raised); }
  .ma-header__nav.is-open { display: block; }
  .ma-nav { flex-direction: column; align-items: stretch; gap: 4px; }
  .ma-nav__link { padding: 12px; min-height: 44px; }
  .ma-header__nav .dropdown-menu { position: static !important; transform: none !important; background: transparent; border: 0; box-shadow: none; padding: 0 0 0 24px; }
  .ma-header__nav .dropdown-item { color: rgba(255,255,255,.85); min-height: 44px; }
  .ma-header__nav .dropdown-item:hover { background: rgba(255,255,255,.1); color: #fff; }
  .ma-header__end .ma-user__name { display: none; }
}
@media (max-width: 767.98px) {
  .ma-main { padding-top: 20px; }
  .ma-page-head__title { font-size: 1.5rem; }
  .ma-page-head__actions, .ma-page-head__actions > .btn, .ma-page-head__actions > form, .ma-page-head__actions > form .btn { width: 100%; }
  .ma-section__head, .ma-section__body { padding-left: var(--ma-s4); padding-right: var(--ma-s4); }
  details.ma-section > summary { padding-left: var(--ma-s4); padding-right: var(--ma-s4); }
  .ma-item { padding: var(--ma-s4); flex-wrap: wrap; }
  .ma-item__aside { flex-direction: row; flex-wrap: wrap; align-items: center; width: 100%; justify-content: space-between; padding-left: 52px; }
  .ma-context { flex-direction: column; padding: var(--ma-s4); }
  .ma-context__actions, .ma-context__actions .btn, .ma-context__actions form { width: 100%; }
  .ma-indicator { flex: 1 1 140px; min-width: 0; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .ma-header .btn-cta { padding: .45rem .7rem; }
  .ma-header .btn-cta .ma-cta-text { display: none; }
  .ma-total__value { font-size: 1.6rem; }
  /* Tablas → filas apiladas legibles (sin scroll horizontal) */
  .ma-table-stack thead { display: none; }
  .ma-table-stack, .ma-table-stack tbody, .ma-table-stack tr, .ma-table-stack td { display: block; width: 100%; }
  .ma-table-stack tr { border-bottom: 1px solid var(--ma-border); padding: var(--ma-s3) var(--ma-s4); }
  .ma-table-stack > :not(caption) > * > * { border: 0 !important; padding: 2px 0 !important; text-align: left !important; }
  .ma-table-stack td[data-label]::before { content: attr(data-label) ": "; color: var(--ma-text-3); font-size: var(--ma-fs-meta); }
  .ma-table-stack td.ma-td-actions { padding-top: 8px !important; }
  .scope-service { padding: 14px; }
  .scope-decision { width: 100%; }
  .scope-decision .btn { flex: 1; }
  .scope-fields { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .ma-header, .ma-live, .ma-page-head__actions { display: none !important; }
  body { background: #fff; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  .ma-header__end .ma-user__name { display: none; }
  .ma-header__inner { gap: var(--ma-s3); }
  .ma-nav__link { padding: 8px 10px; }
}

/* Sprint 4.2.1 ------------------------------------------------------------- */
/* Bloque plegado tras un botón ("+ Cargar nueva entrega" / "Cancelar carga"). */
details.ma-reveal > summary { list-style: none; display: inline-flex; }
details.ma-reveal > summary::-webkit-details-marker { display: none; }
details.ma-reveal .ma-reveal__open, details.ma-reveal[open] .ma-reveal__closed { display: none; }
details.ma-reveal[open] .ma-reveal__open { display: inline-flex; align-items: center; gap: 6px; }
details.ma-reveal .ma-reveal__closed { display: inline-flex; align-items: center; gap: 6px; }
/* Plataforma: aire entre la navegación, el encabezado y el contenido. */
.ma-platform { padding-top: 0; } /* el aire bajo la navbar lo da .ma-main (global) */
.ma-platform .ma-page-head { margin-bottom: var(--ma-s6); }
.ma-platform .ma-eyebrow { margin-bottom: var(--ma-s2); }
.ma-platform .ma-page-head__sub { margin-top: var(--ma-s3); max-width: 62ch; line-height: 1.55; }
.ma-platform .ma-section { margin-bottom: var(--ma-s5); }
.ma-platform .ma-form-section__title { margin-bottom: var(--ma-s3); }
@media (max-width: 575.98px) {
  .ma-platform { padding-top: 0; }
  .ma-platform .ma-page-head { margin-bottom: var(--ma-s5); }
}

/* Sprint 4.2.2 ------------------------------------------------------------- */
/* Layout: pie al fondo en páginas cortas, después del contenido en las largas (sin fixed). */
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }
body > main:not(.ma-main) { display: flex; flex-direction: column; }
.ma-footer { flex-shrink: 0; padding: var(--ma-s4) 0 var(--ma-s5); color: var(--ma-text-3); font-size: .78rem; text-align: center; }
.ma-footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ma-footer a:hover { color: var(--ma-text-2); }
/* Isotipo oficial en navbar y login (ocupa el lugar del cuadrado "MA"). */
.ma-brand__logo { height: 30px; width: auto; display: block; flex-shrink: 0; }
.ma-login__brand .ma-brand__logo { height: 34px; }
/* Bandeja vacía compacta: una fila; al recibir pedidos se expande (región viva). */
.ma-section--compact { box-shadow: none; }
.ma-section--compact .ma-section__head { padding-bottom: var(--ma-s4); }
.ma-section--compact .ma-section__title { font-size: 1rem; color: var(--ma-text-2); font-weight: 600; }
.ma-section__count { color: var(--ma-text-3); font-weight: 500; margin-left: 4px; }
/* "Ver más" local (actividad del Dashboard, últimos envíos). */
.ma-more { margin-top: var(--ma-s2); }
.ma-more > summary { list-style: none; cursor: pointer; display: inline-flex; color: var(--ma-accent); font-weight: 600; font-size: var(--ma-fs-meta); padding: 6px 0; }
.ma-more > summary::-webkit-details-marker { display: none; }
.ma-more[open] > summary { display: none; }
/* Actividad / historial plegado (auditoría). */
.ma-activity-panel > summary { align-items: flex-start; }
.ma-activity-panel__head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ma-activity-panel__title { display: flex; align-items: center; gap: 8px; }
.ma-activity-panel__title .ma-icon { color: var(--ma-brand); }
.ma-activity-panel__last { font-weight: 400; font-size: var(--ma-fs-meta); color: var(--ma-text-3); overflow-wrap: anywhere; }
.ma-activity-panel__toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--ma-accent); font-size: var(--ma-fs-meta); font-weight: 600; white-space: nowrap; }
.ma-activity-panel .ma-reveal__open, .ma-activity-panel[open] .ma-reveal__closed { display: none; }
.ma-activity-panel[open] .ma-reveal__open { display: inline; }
/* Hito ya resuelto (cotización aceptada, alcance confirmado): una línea, con acceso. */
.ma-milestone { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: var(--ma-s3) var(--ma-s4); margin-bottom: var(--ma-s4); background: var(--ma-surface); border: 1px solid var(--ma-border); border-radius: var(--ma-radius); }
.ma-milestone__icon { color: var(--ma-done-ink); display: inline-flex; }
.ma-milestone__text { flex: 1 1 auto; min-width: 0; font-weight: 500; }
.ma-milestone__link { font-weight: 600; font-size: var(--ma-fs-meta); white-space: nowrap; }
/* Bloque de fecha estimada en "Trabajo". */
.ma-due .ma-icon { color: var(--ma-brand); }
@media (max-width: 767.98px) {
  .ma-login { background: linear-gradient(180deg, var(--ma-brand) 0, var(--ma-brand) 96px, var(--ma-bg) 96px); }
  .ma-activity-panel__toggle .ma-reveal__closed, .ma-activity-panel__toggle .ma-reveal__open { display: none !important; }
}
/* Pantallas muy angostas (< 360 px): el isotipo no empuja el menú de usuario fuera del borde. */
@media (max-width: 359.98px) {
  .ma-header__inner { gap: var(--ma-s2); }
  .ma-brand { gap: 6px; font-size: .98rem; }
  .ma-brand__logo { height: 26px; }
}

/* Sprint 4.2.4 — identidad del Workspace en el portal de clientes ----------- */
/* Fallback sin logo: iniciales (mismo lenguaje que el avatar). */
.ma-ws-mark { display: inline-grid; place-items: center; flex-shrink: 0; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.ma-ws-mark--nav { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.18); color: #fff; font-size: .8rem; }
.ma-ws-mark--login { width: 44px; height: 44px; border-radius: 10px; background: var(--ma-brand); color: #fff; font-size: 1rem; }
.ma-ws-mark--list { width: 36px; height: 36px; border-radius: 10px; background: var(--ma-brand-soft); color: var(--ma-brand); font-size: .8rem; }
/* Logo propio: sobre una pastilla blanca (legible con cualquier color), sin deformar
   y sin cambiar la altura de la barra. */
.ma-ws-logo { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: #fff; border-radius: 8px; overflow: hidden; }
.ma-ws-logo img { display: block; width: auto; height: auto; object-fit: contain; }
.ma-ws-logo--nav { height: 34px; padding: 3px 6px; max-width: 140px; }
.ma-ws-logo--nav img { max-height: 28px; max-width: 128px; }
.ma-ws-logo--login { height: 52px; padding: 4px 8px; max-width: 200px; border: 1px solid var(--ma-border); }
.ma-ws-logo--login img { max-height: 44px; max-width: 184px; }
.ma-ws-logo--list { width: 36px; height: 36px; padding: 2px; border: 1px solid var(--ma-border); }
.ma-ws-logo--list img { max-height: 32px; max-width: 32px; }
/* Nombre del Workspace en la barra: se recorta con elipsis (nombre completo en title). */
.ma-brand { min-width: 0; }
.ma-brand__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.ma-login__brand--ws { gap: 12px; align-items: center; }
.ma-login__ws-name { color: var(--ma-text); overflow-wrap: anywhere; line-height: 1.25; }
.ma-login__product { margin: var(--ma-s4) 0 0; text-align: center; font-size: .78rem; color: var(--ma-text-3); }
.ma-login__product a { color: inherit; }
.ma-identity-preview { background: var(--ma-brand); color: #fff; border-radius: var(--ma-radius-sm); padding: 12px 16px; display: flex; }
@media (max-width: 991.98px) { .ma-brand__name { max-width: 180px; } }
@media (max-width: 420px) { .ma-brand__name { max-width: 120px; } .ma-ws-logo--nav { max-width: 96px; } .ma-ws-logo--nav img { max-width: 84px; } }
