/* ==========================================================================
   Kreatik OS — mobile.css
   Ajustes responsive para pantallas pequeñas (teléfono/tablet).
   Convierte el sidebar fijo en un menú superior colapsable con botón
   hamburguesa, y apila las tarjetas/grids en una sola columna.
   ========================================================================== */

/* Botón hamburguesa: oculto en desktop, visible solo en móvil */
.mobile-menu-btn {
  display: none;
}

@media (max-width: 768px) {

  html, body {
    overflow: auto !important;
    height: auto !important;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    width: 100%;
  }

  /* ---------- Sidebar → barra superior colapsable ---------- */
  .sidebar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: auto;
    max-height: 100vh;
    overflow-y: auto;
    z-index: 500;
    padding: 14px 14px 10px;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    background: var(--surface-1);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  }
  .sidebar.header-hidden {
    transform: translateY(-100%);
    pointer-events: none;
  }

  .sidebar-brand {
    padding: 0 0 0;
    justify-content: space-between;
  }

  .sidebar-collapse-btn {
    display: none;
  }
  .sidebar-nav-bottom {
    display: none;
  }
  .sidebar-expand-btn {
    display: none !important;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
  }

  .nav-group {
    display: none;
    flex-direction: column;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
  }

  .sidebar.mobile-open .nav-group {
    display: flex;
  }

  .sidebar-footer {
    display: none;
  }

  .sidebar-flyout {
    display: none !important;
  }

  /* ---------- Main content: deja espacio para la barra fija arriba ---------- */
  .main {
    height: auto;
    min-height: 100vh;
    padding-top: 60px;
  }

  .topbar {
    height: auto;
    padding: 10px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    background: var(--surface-1);
    border-bottom: 1px solid var(--border-soft);
  }
  .topbar .topbar-title { font-size: 16px; }
  .topbar .topbar-subtitle { font-size: 11px; }

  .topbar-actions {
    width: 100%;
  }
  .topbar-actions .btn {
    width: 100%;
  }

  .view-scroll {
    overflow-y: visible;
    padding: 18px 16px 40px;
  }

  /* ---------- Grids: todo se apila en una columna ---------- */
  .grid-2, .grid-3, .grid-4, .two-col-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .result-panel {
    position: static;
  }

  .bento-layout {
    grid-template-columns: 1fr;
  }

  .bento-right {
    position: static;
  }

  #carrito-total-usd {
    font-size: 2rem !important;
  }

  /* ---------- Modal / Vista previa del documento ---------- */
  .modal-overlay {
    padding: 16px 8px;
  }

  .modal-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }

  .doc-toolbar {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 10px;
    gap: 6px;
  }
  .doc-toolbar-left,
  .doc-toolbar-center,
  .doc-toolbar-right {
    flex: 1 1 auto;
    min-width: 0;
  }
  .doc-toolbar-center { order: -1; flex-basis: 100%; justify-content: center; }
  .doc-toolbar-right { flex-wrap: wrap; }
  .doc-toolbar-status { font-size: 11px; min-width: 60px; }

  .doc-sheet {
    padding: 22px 16px;
    transform: scale(0.92);
    transform-origin: top center;
  }

  @media (max-width: 480px) {
    .doc-sheet {
      transform: scale(0.82);
    }
    .registro-stat-grid {
      grid-template-columns: 1fr;
    }
  }

  .doc-cover-title {
    font-size: 32px;
    margin-top: 140px;
  }

  .doc-page-header { flex-direction: row !important; gap: 8px; }
  .doc-page-header img { width: 40px; height: 40px; }
  .doc-page-header-right { text-align: left; }
  .doc-page-header-dates { font-size: 10px; }

  .doc-cover-servicio { font-size: 11px; padding: 8px 12px; }

  .doc-cover-client-table { font-size: 11px; }
  .doc-cover-client-table td.k { width: 90px; }

  .doc-quote-banner {
    flex-direction: column;
  }

  .doc-quote-items-list { font-size: 11px; }
  .doc-quote-total-cell { font-size: 18px; }

  .doc-signatures { flex-direction: column; gap: 30px; }

  .doc-info-table, .doc-quote-table {
    font-size: 11.5px;
  }

  /* ---------- Historial ---------- */
  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .history-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  /* ---------- Color popup responsive ---------- */
  .marca-color-popup {
    left: auto;
    right: 0;
  }
  .marca-color-popup-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  /* ---------- Icon picker modal responsive ---------- */
  .icon-picker-modal-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* ---------- Toolbar de Marcas responsive ---------- */
  .marcas-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
  }
  .marcas-toolbar-search {
    max-width: none;
  }
  .marcas-toolbar-filters {
    flex-wrap: wrap;
  }
  .marcas-filter-select {
    flex: 1;
    min-width: 0;
  }

  /* ---------- Dashboard: gráfica de barras más compacta ---------- */
  .monthly-chart {
    gap: 6px;
    height: 150px;
  }
  .month-bar-label {
    font-size: 9.5px;
  }
  .month-bar-value {
    font-size: 9.5px;
  }

  /* ---------- Notification panel responsive ---------- */
  .notif-panel {
    width: 100vw;
    max-width: 100vw;
  }
  .notif-aviso {
    right: 8px;
    left: 8px;
    max-width: none;
  }

  /* ---------- Registro de trabajo responsive ---------- */
  .registro-stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .registro-table-wrapper {
    overflow-x: auto;
  }
  .registro-table {
    min-width: 600px;
  }
  .registro-group-header {
    padding: 8px 10px;
    font-size: 13px;
  }

  /* ---------- Línea de contenido responsive ---------- */
  .lc-stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .lc-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .lc-tabs {
    justify-content: center;
  }
  .lc-month-selector {
    margin: 0;
    justify-content: center;
  }
  .lc-view-toggle {
    justify-content: center;
  }
  .lc-table-grid {
    overflow-x: auto;
  }
  .lc-table-scroll {
    overflow-x: auto;
  }
  .lc-table {
    min-width: 800px;
  }
  .lc-table-wrapper {
    overflow-x: auto;
  }
  .registro-table th,
  .registro-table td {
    padding: 6px 8px;
    font-size: 12px;
  }
  .sp-nivel-body {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .sp-catalogo-table { min-width: 520px; }
  .sp-pilar-actions { flex-direction: column; }
  .sp-pilar-actions .btn { width: 100%; justify-content: center; }
  .lc-detail-panel { width: 100vw; }
  .lc-kanban { flex-direction: column; }
  .lc-kanban-col { min-width: 100%; max-width: 100%; }
  .lc-cal-day { min-height: 60px; padding: 4px 5px; }
  .lc-cal-day-num { width: 22px; height: 22px; font-size: 10px; }
  .lc-cal-day--today .lc-cal-day-num { width: 22px; height: 22px; }
  .lc-cal-event-badge { font-size: 9px; padding: 1px 3px; }
  .lc-cal-topbar { padding: 10px 12px; }
  .lc-cal-popup { width: 95vw; }
  .db-grid-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .db-grid-3 { grid-template-columns: 1fr; gap: 10px; }
  .db-grid-2 { grid-template-columns: 1fr; gap: 10px; }
  .db-greeting-text { font-size: 22px; }
  .db-chart-wrap { height: 160px; }
  .db-chart-wrap--donut { height: 180px; }
}
@media (max-width: 480px) {
  .db-grid-4 { grid-template-columns: 1fr; }
  .db-greeting-text { font-size: 20px; }
}