/*
  main.css
  ----------------
  Estilos base para dashboard-v2.
  Incluye layout responsive, sidebar y componentes de formulario.
*/
* {
  box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;900&display=swap');

:root {
  --color-primary: #014a96;
  --color-secondary: #008ac7;
  --color-dark: #000000;
  --color-light: #FFFFFF;
  --color-gray: ##f7f7f7;
  --app-header-offset: 80px;

  --font-title: 'Montserrat Black', sans-serif;
  --font-text: 'Montserrat Semibold', sans-serif;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Inter', Arial, sans-serif;
  background: var(--color-gray);
  color: var(--color-dark);
}

/* === link === */
.xie-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  transition: 0.2s;
}

.xie-link.underline {
  text-decoration: underline;
}

.xie-link:hover {
  opacity: 0.7;
}

/* === Buttons === */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  font-family: var(--font-text);
  cursor: pointer;
  transition: 0.3s;
  text-align: center;
  text-decoration: none;
  margin: 3px;
}

.btn.sm {
  padding: 5px 20px;
  font-size: 12px;
}

.btn.w-md {
  width: 200px;
}

.btn.w-lg {
  width: 400px;
}

.btn.w-50 {
  width: 50%;
}

.btn.w-100 {
  width: 100%;
}

.ss-btn.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-light);
}

.ss-btn.btn-transparent {
  background-color: transparent;
}

.ss-btn.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.ss-btn.icon-delete {
  height: 35px;
  width: 35px;
  padding: 5px;
  border-radius: 100%;
}

.ss-btn.icon-action {
  width: 35px;
  height: 35px;
  min-width: 35px;
  padding: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.ss-btn:hover {
  opacity: 0.7;
}

.ss-btn.btn-outline:hover {
  background-color: var(--color-primary);
  color: var(--color-light);
}

/* Botón oscuro */
.btn-dark {
  background-color: var(--color-dark);
  color: var(--color-light);
}

.btn-dark:hover {
  opacity: 0.7;
}

/* Botón claro */
.btn-light {
  background-color: var(--color-light);
  color: var(--color-dark);
  border: 1px solid var(--color-gray);
}

.btn-light:hover {
  background-color: var(--color-gray);
}

/* Botón gris */
.btn-gray {
  background-color: var(--color-gray);
  color: var(--color-dark);
}

.btn-gray:hover {
  background-color: #A9A9A9;
}

.form-grid {
  display: grid;
  gap: 0.5rem;
}

.form-actions {
  display: grid;
  gap: 0.75rem;
}

.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  background: #eef2ff;
  position: relative;
}

.app-load-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1200;
}

.app-load-screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.app-load-screen-card {
  min-width: min(280px, 100%);
  display: grid;
  justify-items: center;
  gap: 0.9rem;
  padding: 1.5rem 1.75rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #dbe7f5;
  border-radius: 18px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
}

.app-load-screen-card p {
  margin: 0;
  color: #334155;
  font-weight: 600;
}

.app-sidebar {
  width: min(300px, calc(100vw - 2rem));
  min-width: 0;
  padding: 1.5rem;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 30;
}

.app-sidebar-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.48);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 25;
}

.app-sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sidebar-brand {
  display: grid;
  gap: 0.75rem;
  align-items: center;
}

.sidebar-logo {
  width: 40px;
  height: auto;
}

.sidebar-menu {
  display: grid;
  gap: 0.5rem;
}

.sidebar-section {
  display: grid;
  gap: 0.5rem;
}

.sidebar-link {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f8fafc;
  color: #0f172a;
  text-align: left;
  text-transform: uppercase;
}

.sidebar-link.active,
.sidebar-link:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.sidebar-link-danger {
  color: #b91c1c;
}

.sidebar-link-danger.active,
.sidebar-link-danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

.sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  line-height: 1;
}

.sidebar-child {
  margin-left: 0.75rem;
}

.sidebar-submenu {
  display: grid;
  gap: 0.25rem;
  padding-left: 0.5rem;
}

.sidebar-actions {
  margin-top: auto;
}

.app-frame {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  padding-top: var(--app-header-offset);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  min-height: var(--app-header-offset);
  left: 0;
  right: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--color-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.header-icon-button {
  position: relative;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbe7f5;
  border-radius: 999px;
  background: #f8fbff;
  color: var(--color-primary);
  cursor: pointer;
}

.header-icon-button i {
  font-size: 1.1rem;
}

.header-icon-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.notifications-menu-panel {
  width: min(320px, calc(100vw - 2rem));
  padding: 0;
}

.notifications-menu-empty {
  padding: 1rem;
}

.notifications-menu-empty strong {
  display: block;
  margin-bottom: 0.5rem;
}

.notifications-menu-empty p {
  margin: 0;
  color: #64748b;
  font-size: 0.92rem;
}

#sidebar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.app-content {
  padding: 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100vh - 90px);
  margin-top: 10px;
}

.welcome-panel {
  padding: 1.5rem;
}

/* === Reusable module layouts === */
.module-shell {
  display: grid;
  gap: 1.25rem;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
}

.module-header h3 {
  margin: 0 0 0.35rem 0;
  font-size: 20px;
}

.module-header p {
  margin: 0;
  color: #475569;
}

.module-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
}

.module-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.module-grid > * {
  min-width: 0;
}

.module-col-4 {
  grid-column: span 4;
}

.module-col-6 {
  grid-column: span 6;
}

.module-col-8 {
  grid-column: span 8;
}

.module-col-12 {
  grid-column: span 12;
}

.module-card,
.data-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  min-width: 0;
}

.module-card h4,
.data-panel h4 {
  margin: 0 0 0.75rem 0;
}

.data-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.data-toolbar .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.data-panel .ss-table-container {
  width: 100%;
  max-width: 100%;
}

.data-panel .ss-table-container .ss-table td {
  font-size: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid #dbe7f5;
  border-radius: 16px;
}

.stat-card strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1.6rem;
}

.module-meta-list {
  display: grid;
  gap: 0.85rem;
}

.module-meta-item {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.module-meta-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.module-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.module-inline-actions .ss-btn {
  min-width: 84px;
}

.module-table-compact {
  min-width: max-content;
}

.module-table-compact thead th,
.module-table-compact tbody td {
  font-size: 0.9rem;
}

.module-table-compact th,
.module-table-compact td {
  padding: 10px 14px;
}

.table-action-col,
.table-action-cell {
  width: 48px;
  min-width: 48px;
  text-align: center;
}

.module-table-compact .table-action-cell,
.module-table-compact .table-action-col {
  padding-inline: 6px;
}

.module-filter-menu {
  width: min(520px, calc(100vw - 2rem));
  padding: 1rem;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.module-filter-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.module-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.module-pagination-summary {
  color: #64748b;
  font-size: 0.92rem;
}

.module-pagination-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.module-pagination-ellipsis {
  padding: 0 0.25rem;
  color: #94a3b8;
}

.module-pagination-size {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #64748b;
  font-size: 0.92rem;
}

.module-pagination-size .ss-input {
  width: auto;
  min-width: 88px;
  padding-block: 0.45rem;
}

.module-reorder-hint {
  margin: 0.85rem 0 0;
  color: #64748b;
  font-size: 0.92rem;
}

.module-reorder-hint.is-warning {
  color: #b45309;
}

.module-drag-cell {
  width: 42px;
  text-align: center;
}

.module-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid #dbe7f5;
  border-radius: 10px;
  background: #f8fbff;
  color: #64748b;
  cursor: grab;
}

.module-drag-handle:active {
  cursor: grabbing;
}

.module-row-locked .module-drag-handle {
  border-style: dashed;
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}

.module-row-ghost {
  opacity: 0.45;
}

.module-row-chosen {
  background: #eff6ff;
}

.module-order-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.module-icon-preview {
  margin-top: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.75rem 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.module-checkbox-list {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.module-check-item {
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
}

.role-module-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.role-module-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
}

.role-module-row.is-invalid {
  border-color: #ef4444;
}

.role-module-field {
  margin: 0;
}

.role-module-actions {
  display: flex;
  align-items: center;
}

.dynamic-list-actions {
  display: flex;
  justify-content: center;
  margin-top: 0.85rem;
}

.dynamic-list-actions .ss-btn {
  min-width: 180px;
}

.customer-section-card {
  padding: 1rem;
}

.customer-section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.customer-section-header h4,
.customer-section-header p {
  margin: 0;
}

.customer-section-header p {
  color: #64748b;
}

.customer-info-list,
.customer-document-list {
  display: grid;
  gap: 0.85rem;
}

.customer-info-row,
.customer-document-row {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
}

.customer-info-row {
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  align-items: start;
}

.customer-document-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(220px, 1fr) auto;
  align-items: start;
}

.customer-info-row.is-invalid,
.customer-document-row.is-invalid {
  border-color: #ef4444;
}

.customer-dynamic-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}

.customer-document-saved {
  grid-column: 1 / -2;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.customer-document-saved a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.profile-summary {
  display: grid;
  gap: 1rem;
  justify-items: center;
  text-align: center;
}

.profile-avatar-wrap {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #eff6ff, #dbeafe);
  overflow: hidden;
}

.profile-avatar {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 999px;
  border: 3px solid #ffffff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.profile-avatar.lg {
  width: 132px;
  height: 132px;
}

.profile-muted {
  margin: 0;
  color: #64748b;
}

.profile-panel {
  display: grid;
  gap: 1rem;
}

.profile-edit-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.profile-upload-block {
  flex: 1;
  min-width: 220px;
}

.app-footer {
  padding: 1rem 1.5rem;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .app-sidebar {
    width: min(280px, calc(100vw - 1.5rem));
  }

  .app-frame {
    min-height: 100vh;
  }

  .module-col-4,
  .module-col-6,
  .module-col-8,
  .module-col-12 {
    grid-column: span 12;
  }

  .customer-info-row,
  .customer-document-row {
    grid-template-columns: 1fr;
  }

}
