@media (max-width: 767.98px) {
  /*
   * Capa movil de Empty Space (2026-11-20).
   * Todo este archivo vive dentro de este unico media query: desde 768 px ninguna clase m-* existe,
   * asi que no puede cambiar nada del escritorio. test/assets/mobile_css_test.rb lo vigila.
   * Reglas: .claude/skills/empty-space-design-system/references/mobile.md seccion 12.
   */

  :root {
    --m-page-bg: #F3F4F6;
    --m-surface: #FFFFFF;
    --m-line: #E5E7EB;
    --m-line-soft: #F3F4F6;
    --m-text: #111827;
    --m-body: #374151;
    --m-muted: #6B7280;
    --m-faint: #9CA3AF;
    --m-accent: #3B82F6;
    --m-accent-strong: #2563EB;
    --m-accent-text: #1D4ED8;
    --m-accent-light: #EFF6FF;
    --m-accent-border: #BFDBFE;
    --m-mark: #DBEAFE;
    --m-danger: #DC2626;
    --m-success: #16A34A;
    --m-warning: #B45309;
    --m-clara: #7C3AED;
    --m-scrim: rgba(17, 24, 39, .4);
    --m-gutter: 16px;
    --m-radius-card: 16px;
    --m-radius-control: 10px;
    --m-radius-sheet: 20px;
    --m-tap: 44px;
    --m-row-1: 56px;
    --m-row-2: 64px;
    --m-row-3: 76px;
    --m-sheet-row: 52px;
    --m-tabbar: 56px;
    --m-safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* ---------- Pagina y titulos ---------- */

  .m-page {
    background: var(--m-page-bg);
    padding-left: var(--m-gutter);
    padding-right: var(--m-gutter);
    padding-bottom: calc(80px + var(--m-safe-bottom));
    font-size: 16px;
    line-height: 24px;
    color: var(--m-text);
  }

  .m-screen-title {
    font-size: 28px;
    line-height: 34px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--m-text);
  }

  .m-bar-title,
  .m-section-title {
    font-size: 17px;
    line-height: 22px;
    font-weight: 600;
    color: var(--m-text);
  }

  /* ---------- Grupo con encabezado ---------- */

  .m-group-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 16px;
    margin: 28px 4px 8px;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--m-muted);
  }

  .m-group-label--first { margin-top: 16px; }

  .m-group-label-text {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .m-group-count {
    margin-left: 6px;
    letter-spacing: 0;
    font-weight: 500;
  }

  .m-group-action {
    display: inline-flex;
    align-items: center;
    min-height: var(--m-tap);
    margin: -14px 0;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--m-accent-strong);
  }

  .m-card {
    display: block;
    background: var(--m-surface);
    border: 0;
    border-radius: var(--m-radius-card);
    box-shadow: none;
    overflow: hidden;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .m-card + .m-card { margin-top: 12px; }

  /* ---------- Fila de lista ---------- */

  .m-row {
    display: flex;
    align-items: center;
    padding-left: 16px;
    background: var(--m-surface);
    list-style: none;
  }

  .m-row--1 { height: var(--m-row-1); }
  .m-row--2 { height: var(--m-row-2); }
  .m-row--3 { height: var(--m-row-3); }

  .m-row-main {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .m-row-main:active { background: var(--m-line-soft); }

  .m-row-main:focus-visible {
    outline: 2px solid var(--m-accent);
    outline-offset: -2px;
  }

  .m-row-leading {
    flex: none;
    margin-right: 12px;
    display: flex;
    align-items: center;
  }

  /* La linea separa desde el texto, no bajo el icono. */
  .m-row-body {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
    border-bottom: 1px solid var(--m-line);
  }

  .m-row-body--last { border-bottom: 0; }

  .m-row-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .m-row-title {
    font-size: 16px;
    line-height: 22px;
    font-weight: 500;
    color: var(--m-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-row-title--dim { color: var(--m-faint); }

  .m-row-title mark {
    background: var(--m-mark);
    color: var(--m-text);
    border-radius: 3px;
    font-weight: 600;
  }

  .m-row-meta {
    display: flex;
    align-items: center;
    min-width: 0;
    font-size: 13px;
    line-height: 18px;
    color: var(--m-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-row-meta-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-row-meta--danger {
    color: var(--m-danger);
    font-weight: 500;
  }

  .m-dot {
    flex: none;
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 9999px;
    background: var(--m-danger);
  }

  .m-row-trailing {
    flex: none;
    display: flex;
    align-items: center;
  }

  /* La fila con menu: el menu es hermano de la zona principal y lleva su propia linea. */
  .m-row-side {
    flex: none;
    height: 100%;
    display: flex;
    align-items: center;
    padding-right: 2px;
    border-bottom: 1px solid var(--m-line);
  }

  .m-row-side--last { border-bottom: 0; }

  .m-row-more,
  .m-row-check,
  .m-icon-btn {
    flex: none;
    width: var(--m-tap);
    height: var(--m-tap);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: var(--m-muted);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .m-icon-btn { color: var(--m-text); }

  .m-row-more:active,
  .m-icon-btn:active { background: var(--m-line-soft); }

  .m-row-more:focus-visible,
  .m-row-check:focus-visible,
  .m-icon-btn:focus-visible {
    outline: 2px solid var(--m-accent);
    outline-offset: -2px;
  }

  .m-icon-btn[hidden],
  .m-sheet-head[hidden],
  .m-sheet-title-bar[hidden],
  .m-sheet-foot[hidden] { display: none; }

  .m-icon-circle {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: var(--m-line-soft);
    color: var(--m-body);
  }

  /* ---------- Icono de archivo ---------- */

  .m-ficon {
    flex: none;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 10px;
    font-size: 12px;
    line-height: 16px;
    font-weight: 700;
    letter-spacing: .02em;
    background: #F3F4F6;
    color: #4B5563;
  }

  .m-ficon--pdf { background: #FEE2E2; color: #DC2626; }
  .m-ficon--dwg { background: #DBEAFE; color: #1D4ED8; }
  .m-ficon--xlsx { background: #DCFCE7; color: #15803D; }
  .m-ficon--docx { background: #E0E7FF; color: #4338CA; }
  .m-ficon--image { background: #CCFBF1; color: #0F766E; }
  .m-ficon--folder { background: #EFF6FF; color: #3B82F6; }
  .m-ficon--other { background: #F3F4F6; color: #4B5563; }
  .m-ficon--off { background: #E5E7EB; color: #6B7280; }
  .m-ficon img { width: 100%; height: 100%; object-fit: cover; }

  /* ---------- Busqueda y chips ---------- */

  .m-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 9999px;
    background: var(--m-surface);
    color: var(--m-muted);
    font-size: 16px;
    line-height: 22px;
    text-align: left;
  }

  .m-search--on-white { background: var(--m-line-soft); }

  .m-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: var(--m-text);
  }

  /* El relleno vertical (compensado con margen negativo) deja sitio a la zona tactil de 44 px de
     cada chip: una fila con overflow-x recorta lo que sobresale. */
  .m-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: -4px;
    margin-bottom: -4px;
    padding-top: 4px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .m-chips::-webkit-scrollbar { display: none; }

  .m-chip {
    position: relative;
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--m-line);
    border-radius: 9999px;
    background: var(--m-surface);
    color: var(--m-body);
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    white-space: nowrap;
  }

  /* Se ve de 36 px; se toca en 44 px (5 px desde el borde interior: 1 de borde + 4 fuera). */
  .m-chip::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -5px;
    bottom: -5px;
  }

  .m-chip--active {
    background: var(--m-accent-light);
    border-color: var(--m-accent-border);
    color: var(--m-accent-text);
  }

  /* ---------- Chip de estado ---------- */

  .m-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 8px;
    border-radius: 9999px;
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    white-space: nowrap;
  }

  .m-status::before {
    content: "";
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 9999px;
    background: currentColor;
  }

  .m-status--green { background: #F0FDF4; color: #15803D; }
  .m-status--amber { background: #FFFBEB; color: #B45309; }
  .m-status--red { background: #FEF2F2; color: #B91C1C; }
  .m-status--gray { background: #F3F4F6; color: #4B5563; }

  /* ---------- Botones y pie fijo ---------- */

  .m-btn-primary,
  .m-btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 0;
    border-radius: var(--m-radius-control);
    font-size: 16px;
    line-height: 22px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
  }

  .m-btn-primary { background: var(--m-accent); color: #FFFFFF; }
  .m-btn-primary:active { background: var(--m-accent-strong); }
  .m-btn-secondary { background: var(--m-line-soft); color: var(--m-text); }
  .m-btn-primary:disabled,
  .m-btn-secondary:disabled { opacity: .5; cursor: not-allowed; }

  .m-btn-primary:focus-visible,
  .m-btn-secondary:focus-visible {
    outline: 2px solid var(--m-accent);
    outline-offset: 2px;
  }

  .m-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px calc(12px + var(--m-safe-bottom));
    background: var(--m-surface);
    border-top: 1px solid var(--m-line);
  }

  /* Los avisos no tapan el boton principal: suben sobre el pie fijo y sobre el pie de una hoja. */
  html.m-sheet-open #toast-container,
  body:has(.m-footer) #toast-container {
    bottom: calc(84px + var(--m-safe-bottom));
  }

  /* El panel de detalle (tarea) pide 32rem de ancho minimo: en un telefono quedaba cortado por la izquierda. */
  #flyout-details > .flyout-panel {
    width: 100%;
    min-width: 0;
  }

  .m-footer-note {
    font-size: 13px;
    line-height: 18px;
    color: var(--m-muted);
    text-align: center;
  }

  /* ---------- Hoja inferior ---------- */

  html.m-sheet-open,
  html.m-sheet-open body { overflow: hidden; }

  .m-sheet-root {
    position: fixed;
    inset: 0;
    z-index: 60;
  }

  .m-sheet-root:not([hidden]) {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }

  .m-scrim {
    position: absolute;
    inset: 0;
    background: var(--m-scrim);
    opacity: 0;
    touch-action: none;
    transition: opacity 200ms ease;
  }

  .m-sheet {
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    max-height: 85dvh;
    background: var(--m-surface);
    border-radius: var(--m-radius-sheet) var(--m-radius-sheet) 0 0;
    padding-bottom: var(--m-safe-bottom);
    transform: translateY(100%);
    transition: transform 200ms cubic-bezier(0.32, 0.72, 0, 1);
    outline: none;
  }

  .m-sheet-root--open .m-scrim { opacity: 1; }
  .m-sheet-root--open .m-sheet { transform: translateY(0); }

  .m-sheet-handle {
    flex: none;
    width: 36px;
    height: 4px;
    margin: 8px auto 4px;
    border-radius: 9999px;
    background: #D1D5DB;
  }

  .m-sheet-title-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 52px;
    padding: 0 8px;
  }

  /* Un hueco del ancho del boton Cerrar mantiene el titulo centrado cuando no hay flecha. */
  .m-sheet-title-bar::before {
    content: "";
    flex: none;
    width: var(--m-tap);
  }

  .m-sheet-title-bar--back::before { display: none; }

  .m-sheet-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    text-align: center;
    font-size: 17px;
    line-height: 22px;
    font-weight: 600;
    color: var(--m-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-sheet-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 8px 12px 20px;
    border-bottom: 1px solid var(--m-line-soft);
  }

  .m-sheet-head-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .m-sheet-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
  }

  .m-sheet-foot {
    flex: none;
    padding: 12px 16px;
    border-top: 1px solid var(--m-line-soft);
    background: var(--m-surface);
  }

  .m-sheet-foot:empty { display: none; }

  .m-sheet-row {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: var(--m-sheet-row);
    padding: 0 0 0 20px;
    border: 0;
    background: transparent;
    color: var(--m-text);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .m-sheet-row:active { background: var(--m-line-soft); }

  .m-sheet-row:focus-visible {
    outline: 2px solid var(--m-accent);
    outline-offset: -2px;
  }

  .m-sheet-row-icon {
    flex: none;
    display: flex;
    width: 24px;
    margin-right: 16px;
    color: var(--m-body);
  }

  .m-sheet-row-body {
    flex: 1;
    min-width: 0;
    min-height: var(--m-sheet-row);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-right: 20px;
    border-bottom: 1px solid var(--m-line-soft);
  }

  .m-sheet-row:last-child .m-sheet-row-body { border-bottom: 0; }

  .m-sheet-row-label {
    min-width: 0;
    font-size: 16px;
    line-height: 22px;
    color: var(--m-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-sheet-row-detail {
    flex: none;
    font-size: 13px;
    line-height: 18px;
    color: var(--m-muted);
  }

  .m-sheet-row--danger .m-sheet-row-icon,
  .m-sheet-row--danger .m-sheet-row-label { color: var(--m-danger); }

  .m-sheet-divider {
    height: 8px;
    background: var(--m-line-soft);
  }

  .m-sheet-skeleton {
    height: 52px;
    margin: 0 20px;
    border-bottom: 1px solid var(--m-line-soft);
    background: linear-gradient(90deg, #F3F4F6 0, #F9FAFB 50%, #F3F4F6 100%);
    background-size: 200% 100%;
    animation: m-shimmer 1.2s linear infinite;
  }

  @keyframes m-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
  }

  /* El datepicker y el select custom deben verse sobre la hoja. */
  .m-sheet .align-select-dropdown,
  .m-sheet .align-datepicker-dropdown { z-index: 61; }

  /* ---------- Barra inferior y Clara ---------- */

  .m-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    padding: 0 4px var(--m-safe-bottom);
    background: var(--m-surface);
    border-top: 1px solid var(--m-line);
  }

  .m-tabbar-list {
    flex: 1;
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .m-tabbar-item { flex: 1; min-width: 0; }

  .m-tabbar-link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    height: var(--m-tabbar);
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--m-muted);
    font: inherit;
    font-size: 11px;
    line-height: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .m-tabbar-link[aria-current="page"] { color: var(--m-accent-strong); }

  .m-tabbar-link:focus-visible {
    outline: 2px solid var(--m-accent);
    outline-offset: -2px;
  }

  .m-tabbar-icon {
    position: relative;
    display: flex;
    width: 24px;
    height: 24px;
  }

  .m-tabbar-badge {
    position: absolute;
    top: -4px;
    left: 14px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid var(--m-surface);
    border-radius: 9999px;
    background: var(--m-danger);
    color: #FFFFFF;
    font-size: 11px;
    line-height: 14px;
    font-weight: 600;
    text-align: center;
    box-sizing: content-box;
  }

  .m-fab {
    position: fixed;
    right: 16px;
    bottom: calc(var(--m-tabbar) + 16px + var(--m-safe-bottom));
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    background: var(--m-clara);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(124, 58, 237, .28);
    cursor: pointer;
  }

  .m-fab:focus-visible {
    outline: 2px solid var(--m-clara);
    outline-offset: 2px;
  }

  /* Mientras se baja por una lista el boton se aparta (no tapa la hora ni el final de las filas);
     vuelve al subir o al llegar arriba (tab_bar_controller.js). */
  .m-fab {
    transition: transform .2s ease, opacity .2s ease;
  }

  .m-fab--away {
    transform: translateY(24px) scale(.6);
    opacity: 0;
    pointer-events: none;
  }

  /* ---------- Estado vacio y campos ---------- */

  .m-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 8px 28px;
    text-align: center;
  }

  .m-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 9999px;
    background: var(--m-line-soft);
    color: var(--m-muted);
  }

  .m-empty-title {
    margin-top: 16px;
    font-size: 17px;
    line-height: 22px;
    font-weight: 600;
    color: var(--m-text);
  }

  .m-empty-text {
    margin-top: 6px;
    font-size: 14px;
    line-height: 20px;
    color: var(--m-muted);
  }

  .m-input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 0;
    border-radius: var(--m-radius-control);
    background: var(--m-line-soft);
    color: var(--m-text);
    font-size: 16px;
    line-height: 22px;
    outline: none;
  }

  .m-input:focus { box-shadow: 0 0 0 2px var(--m-accent); }

  /* ---------- Cromo montado (paso 3, 2026-11-20) ---------- */

  /* El body autenticado (m-shell) mide el alto visible real y deja libre la zona segura de arriba
     (viewport-fit=cover). body.* gana a h-screen de Tailwind, que se inyecta despues. */
  body.m-shell {
    height: 100vh;
    height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px);
  }

  /* La barra superior global (hamburguesa, busqueda, Clara, avatar) no existe en el telefono: la barra
     inferior, el boton de Clara y la hoja Mas la reemplazan. Entre 768 y 1023 px sigue igual. */
  body.m-shell .m-chrome-header { display: none; }

  /* Pantalla raiz: al final del scroll el ultimo elemento queda por encima de la barra inferior Y del
     boton de Clara (barra + 16 + 48 de boton + 16 de aire = barra + 80). */
  body[data-mobile-chrome="root"] .m-main {
    padding-bottom: calc(var(--m-tabbar) + 80px + var(--m-safe-bottom));
  }

  /* La Bandeja scrollea dentro de .m-inbox-scroll, que ya deja 88 px bajo la ultima fila: <main> solo
     reserva la barra. */
  body[data-mobile-chrome="root"] .m-main:has(.m-inbox-list) {
    padding-bottom: calc(var(--m-tabbar) + 16px + var(--m-safe-bottom));
  }

  /* Una pantalla raiz con fondo gris (.m-page) pinta tambien la franja del relleno inferior de <main>. */
  body[data-mobile-chrome="root"] .m-main:has(.m-dash) { background: var(--m-page-bg); }

  /* Pantalla hija: sin barra inferior ni boton de Clara; trae su propia .m-appbar. */
  body[data-mobile-chrome="child"] .m-tabbar { display: none; }

  /* Avisos a lo ancho, por encima de la barra y del boton de Clara (raiz) o del pie fijo (hija). */
  #toast-container {
    left: var(--m-gutter);
    right: var(--m-gutter);
  }

  body[data-mobile-chrome="root"] #toast-container {
    bottom: calc(var(--m-tabbar) + 76px + var(--m-safe-bottom));
  }

  /* Clara a pantalla completa en el telefono. */
  #clara-panel {
    width: 100%;
    max-width: none;
    padding-top: env(safe-area-inset-top, 0px);
  }

  /* 16 px: con menos, iOS hace zoom al enfocar el campo de Clara. Campo y botones de 44 px. */
  #clara-panel-input {
    min-height: var(--m-tap);
    font-size: 16px;
    line-height: 24px;
  }

  #clara-panel { padding-bottom: var(--m-safe-bottom); }

  #clara-panel > div:first-child button,
  #clara-panel-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--m-tap);
    min-height: var(--m-tap);
  }

  /* La barra de acciones en lote (leads) sube por encima de la barra inferior. */
  body[data-mobile-chrome="root"] [data-testid="bulk-action-bar"] {
    bottom: calc(var(--m-tabbar) + 12px + var(--m-safe-bottom));
  }

  /* ---------- Barra de pantalla hija ---------- */

  .m-appbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 56px;
    padding: 0 6px;
    background: var(--m-surface);
    border-bottom: 1px solid var(--m-line);
  }

  .m-appbar-center {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .m-appbar-title,
  .m-appbar-sub {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-appbar-title {
    font-size: 17px;
    line-height: 22px;
    font-weight: 600;
    color: var(--m-text);
  }

  .m-appbar-sub {
    font-size: 13px;
    line-height: 18px;
    color: var(--m-muted);
  }

  /* ---------- Cabecera de proyecto: avance y vistas ---------- */

  .m-project-summary {
    padding: 12px var(--m-gutter) 4px;
    background: var(--m-surface);
  }

  .m-project-summary--end {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--m-line);
  }

  .m-progress-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 24px;
  }

  .m-progress-text {
    min-width: 0;
    font-size: 13px;
    line-height: 18px;
    color: var(--m-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-progress-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--m-text);
    font-variant-numeric: tabular-nums;
  }

  .m-progress {
    height: 6px;
    margin-top: 8px;
    border-radius: 9999px;
    background: var(--m-line);
    overflow: hidden;
  }

  .m-progress-bar {
    height: 100%;
    border-radius: 9999px;
    background: var(--m-accent);
    transition: width 300ms ease;
  }

  .m-progress-bar--done { background: var(--m-success); }

  /* Lo previsto a hoy (PRD-008 05 F3): una raya fina gris bajo la barra del avance real. */
  .m-progress-plan {
    height: 3px;
    margin-top: 4px;
    border-radius: 9999px;
    background: var(--m-line-soft);
    overflow: hidden;
  }

  .m-progress-plan-bar {
    height: 100%;
    border-radius: 9999px;
    background: var(--m-faint);
  }

  /* Estado (En tiempo, Atención, Atrasado) y aviso de tareas sin fecha, bajo las barras. */
  .m-progress-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
  }

  .m-progress-undated {
    font-size: 13px;
    line-height: 18px;
    color: var(--m-muted);
  }

  /* Chip neutro del código de Odoo ("Odoo S0012"): borde gris, sin color de estado. */
  .m-code-row {
    display: flex;
    margin-bottom: 8px;
  }

  .m-code-chip {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 8px;
    border: 1px solid var(--m-line);
    border-radius: 9999px;
    background: var(--m-surface);
    color: var(--m-body);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    white-space: nowrap;
  }

  .m-view-nav {
    padding: 12px 0;
    background: var(--m-surface);
    border-bottom: 1px solid var(--m-line);
  }

  .m-view-nav .m-chips {
    padding-left: var(--m-gutter);
    padding-right: var(--m-gutter);
    scroll-padding-left: var(--m-gutter);
  }

  /* ---------- Hoja Mas: cuenta ---------- */

  .m-account {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }

  .m-account-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .m-account-name {
    font-size: 17px;
    line-height: 22px;
    font-weight: 600;
    color: var(--m-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-account-meta {
    font-size: 13px;
    line-height: 18px;
    color: var(--m-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-sheet-form { margin: 0; }

  /* ---------- Inicio (dashboard) ---------- */

  .m-dash [hidden] { display: none !important; }

  /* <main> ya reserva la barra y el boton de Clara al final: sin el relleno extra de .m-page. */
  .m-dash { min-height: 100%; padding-bottom: 0; }

  .m-dash-head { padding-top: 12px; }

  .m-dash-subtitle {
    margin-top: 2px;
    font-size: 15px;
    line-height: 20px;
    color: var(--m-muted);
  }

  /* Cuatro cifras en 2 x 2: la cifra manda, la etiqueta debajo; tarjeta blanca sin borde de color. */
  .m-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
  }

  .m-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 14px 16px;
    border-radius: var(--m-radius-card);
    background: var(--m-surface);
  }

  .m-metric-value {
    font-size: 28px;
    line-height: 34px;
    font-weight: 600;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    color: var(--m-text);
  }

  .m-metric-value--danger { color: var(--m-danger); }

  .m-metric-label {
    font-size: 13px;
    line-height: 18px;
    color: var(--m-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-dash-pct {
    padding-right: 16px;
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--m-muted);
  }

  /* ---------- Tablero y lista de tareas del proyecto (m-board, paso 4) ----------
     Columnas apiladas como grupos (nombre, conteo y avance en una linea, + para agregar), tarjetas
     compactas y "..." con hoja (abrir, mover a etapa, cambiar estado, completar). Los selectores llevan
     dos clases o elemento + clase: Tailwind por CDN se inyecta despues y sus utilidades tienen una. */

  .m-board-desk.m-board-desk { display: none; }

  .m-board-bleed {
    margin-left: calc(-1 * var(--m-gutter));
    margin-right: calc(-1 * var(--m-gutter));
    background: var(--m-page-bg);
  }

  .m-board-bar {
    padding: 12px var(--m-gutter) 0;
    background: var(--m-page-bg);
  }

  .m-board-segmented {
    display: flex;
    gap: 4px;
    height: 44px;
    padding: 4px;
    border-radius: var(--m-radius-control);
    background: #E5E7EB;
  }

  .m-board-segment {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    border-radius: 8px;
    color: var(--m-body);
    font-size: 15px;
    line-height: 20px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
  }

  /* El segmento visible mide 36 px; la barra entera (44 px) es su zona tactil. */
  .m-board-segment { position: relative; }
  .m-board-segment::after { content: ""; position: absolute; left: 0; right: 0; top: -4px; bottom: -4px; }

  .m-board-segment--active {
    background: var(--m-surface);
    color: var(--m-text);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(17, 24, 39, .08);
  }

  .m-board-segment:focus-visible {
    outline: 2px solid var(--m-accent);
    outline-offset: 2px;
  }

  /* flow-root: el margen del primer grupo no se escapa por arriba del tablero. */
  div.m-board {
    display: flow-root;
    overflow: visible;
    padding: 0 var(--m-gutter) calc(96px + var(--m-safe-bottom));
    background: var(--m-page-bg);
  }

  div.m-board-cols {
    display: block;
    padding-bottom: 0;
  }

  /* space-x-6 (0,3,0) pone margen a cada columna: aqui las columnas se apilan. */
  div.m-board-cols > div.m-board-col {
    width: auto;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .m-board-group-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin: 16px 0 4px;
    padding-left: 4px;
  }

  .m-board-group-title {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--m-muted);
  }

  .m-board-group-name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .m-board-group-count {
    flex: none;
    font-weight: 500;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
  }

  .m-board-group-progress {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .m-board-group-progress[hidden] { display: none; }

  .m-board-meter {
    display: block;
    width: 48px;
    height: 4px;
    border-radius: 9999px;
    background: var(--m-line);
    overflow: hidden;
  }

  .m-board-meter-bar {
    display: block;
    height: 100%;
    border-radius: 9999px;
    background: var(--m-accent);
  }

  .m-board-meter-bar--done { background: var(--m-success); }

  .m-board-group-pct {
    min-width: 34px;
    font-size: 13px;
    line-height: 18px;
    color: var(--m-muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .m-board-add,
  .m-board-more {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--m-tap);
    height: var(--m-tap);
    padding: 0;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: var(--m-muted);
    cursor: pointer;
  }

  .m-board-add { color: var(--m-accent-strong); }

  .m-board-add:active,
  .m-board-more:active { background: var(--m-line); }

  .m-board-add:focus-visible,
  .m-board-more:focus-visible {
    outline: 2px solid var(--m-accent);
    outline-offset: -2px;
  }

  .m-board .m-board-tasks {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0 !important;
  }

  .m-board .m-board-tasks > * { margin-top: 0 !important; }

  .m-board-empty {
    margin: 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--m-surface);
    font-size: 14px;
    line-height: 20px;
    color: var(--m-faint);
  }

  .m-board-tasks:has(.m-board-card) ~ .m-board-empty { display: none; }

  .m-board .m-board-card {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 64px;
    padding: 10px 0 10px 16px;
    border: 0;
    border-radius: 12px;
    box-shadow: none;
  }

  .m-board-card-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .m-board-card-title,
  .m-board-row-title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 16px;
    line-height: 22px;
    font-weight: 500;
    color: var(--m-text);
  }

  .m-board-card-meta,
  .m-board-row-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 13px;
    line-height: 18px;
    color: var(--m-muted);
  }

  .m-board-card-meta > *,
  .m-board-row-meta > * { flex: none; }

  .m-board-card-stage,
  .m-board-row-stage {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-board-card-meta .m-status,
  .m-board-row-meta .m-status { height: 22px; }

  .m-board-chip--blue { background: #EFF6FF; color: #1D4ED8; }

  .m-board-card-date--late,
  .m-board-row-date--late { color: var(--m-danger); font-weight: 500; }

  .m-board-card-date--today,
  .m-board-row-date--today { color: #C2410C; font-weight: 500; }

  .m-board-card-priority,
  .m-board-row-priority { color: #C2410C; font-weight: 500; }

  .m-board-card[data-completed="true"] .m-board-card-title { color: var(--m-muted); }

  /* Hoja de la tarjeta: la etapa o el estado actual en azul. */
  .m-board-sheet .m-sheet-row[aria-current="true"] .m-sheet-row-label {
    color: var(--m-accent-text);
    font-weight: 600;
  }

  .m-board-sheet .m-sheet-row[hidden] { display: none; }

  /* Lista del proyecto: filas de 64 px sobre la pagina gris. */
  .m-board-bleed--list {
    min-height: 70vh;
    min-height: 70dvh;
    padding: 12px var(--m-gutter) calc(96px + var(--m-safe-bottom));
  }

  div.m-board-list {
    border-radius: var(--m-radius-card);
    box-shadow: none;
    overflow: hidden;
  }

  div.m-board-row {
    display: flex;
    align-items: center;
    min-height: 64px;
    padding: 10px 16px;
  }

  .m-board-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  /* ---------- Por aprobar (PRD-008 04 F6a) ---------- */

  /* <main> ya reserva la barra y el boton de Clara al final: sin el relleno extra de .m-page. */
  .m-approvals { min-height: 100%; padding-bottom: 0; }

  .m-approvals [hidden] { display: none !important; }

  .m-approvals .m-undo { margin-top: 16px; }

  /* Texto de contexto en lo alto de una hoja y campos dentro de ella. */
  .m-sheet-context {
    margin: 0;
    padding: 4px 20px 12px;
    font-size: 14px;
    line-height: 20px;
    color: var(--m-muted);
  }

  .m-sheet-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 20px 16px;
  }

  .m-sheet-field-label {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: var(--m-text);
  }

  /* Campo de varias lineas: mismo aspecto que .m-input, alto libre (16 px: sin zoom de iOS). */
  .m-input--area {
    height: auto;
    min-height: 112px;
    padding: 12px 14px;
    resize: vertical;
  }

  /* ---------- Finanzas (PRD-008 section 03; m-finanzas.html F2 y F4) ----------
     Cifras de dinero: tabulares, una protagonista por tarjeta; rojo solo para lo vencido. */

  .m-fin-metric.m-fin-metric { font-size: 22px; line-height: 28px; }

  .m-fin-amount {
    padding-right: 4px;
    font-size: 15px;
    line-height: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--m-text);
    white-space: nowrap;
  }

  .m-fin-amount--danger,
  .m-fin-danger { color: var(--m-danger); }

  .m-fin-note { margin: 8px 4px 0; text-align: left; }

  .m-fin-actions { margin-top: 16px; }

  .m-fin-sheet-line {
    margin: 0;
    padding: 4px 20px 12px;
    font-size: 14px;
    line-height: 20px;
    color: var(--m-muted);
  }

  .m-fin-segmented { margin-top: 16px; }

  .m-fin-hero {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--m-radius-card);
    background: var(--m-surface);
  }

  .m-fin-hero-value {
    font-size: 32px;
    line-height: 38px;
    font-weight: 600;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    color: var(--m-text);
  }

  .m-fin-hero-meta {
    font-size: 13px;
    line-height: 18px;
    color: var(--m-muted);
  }

  @media (prefers-reduced-motion: reduce) {
    .m-scrim,
    .m-sheet { transition: none; }

    .m-sheet-skeleton { animation: none; }

    .m-progress-bar { transition: none; }

    .m-fab { transition: none; }
  }
}
