/* App shell — admin & client areas */

.auth-page {
  min-height: 100dvh;
  background: linear-gradient(135deg, var(--color-hero-bg) 0%, #1e293b 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-hover);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--color-border);
}

.auth-card__brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-card__brand i {
  font-size: 2rem;
  color: var(--color-primary);
}

.auth-card .form-control,
.auth-card .btn {
  min-height: 44px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--color-text-muted);
  font-size: .875rem;
  margin: 1.25rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.app-shell {
  display: flex;
  min-height: 100dvh;
  background: var(--color-surface);
}

.app-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 100;
}

.app-sidebar__brand {
  padding: 1.25rem 1.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.app-sidebar__brand i {
  color: var(--color-primary);
}

.app-sidebar__nav {
  padding: 1rem .75rem;
  flex-grow: 1;
}

.app-sidebar__link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  border-radius: .5rem;
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: .25rem;
  min-height: 44px;
}

.app-sidebar__link:hover,
.app-sidebar__link:focus {
  background: var(--color-surface);
  color: var(--color-text);
}

.app-sidebar__link.active {
  background: rgba(37, 211, 102, .12);
  color: var(--color-primary-dark);
  font-weight: 600;
}

.app-sidebar__link i {
  font-size: 1.125rem;
  width: 1.25rem;
  text-align: center;
}

.app-sidebar__footer {
  padding: 1rem .75rem;
  border-top: 1px solid var(--color-border);
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-topbar__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
  margin: 0;
}

.app-content {
  padding: 1.5rem;
  flex: 1;
}

@media (min-width: 768px) {
  .app-content {
    padding: 2rem;
  }
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: .25rem;
}

.page-header p {
  color: var(--color-text-muted);
  margin: 0;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-card);
}

.stat-card__label {
  font-size: .8125rem;
  color: var(--color-text-muted);
  margin-bottom: .25rem;
}

.stat-card__value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .65rem;
  border-radius: 2rem;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge--pendiente {
  background: #FEF3C7;
  color: #92400E;
}

.status-badge--validada {
  background: #DBEAFE;
  color: #1E40AF;
}

.status-badge--demo_enviada {
  background: #D1FAE5;
  color: #065F46;
}

.status-badge--rechazada {
  background: #F1F5F9;
  color: #475569;
}

.app-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.app-card__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  margin: 0;
}

.data-table th {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  font-weight: 600;
  border-bottom-width: 1px;
  white-space: nowrap;
}

.data-table td {
  vertical-align: middle;
  font-size: .9375rem;
}

.data-table .btn-sm {
  min-height: 36px;
}

.data-card-mobile {
  display: none;
}

@media (max-width: 767.98px) {
  .data-table-wrap {
    display: none;
  }
  .data-card-mobile {
    display: block;
  }
  .data-card-mobile__item {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-card);
  }
  .data-card-mobile__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
  }
}

.plan-banner {
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.plan-banner--demo {
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border: 1px solid #BFDBFE;
}

.plan-banner--pro {
  background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
  border: 1px solid #A7F3D0;
}

.plan-badge {
  display: inline-block;
  padding: .25rem .75rem;
  border-radius: 2rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.plan-badge--demo {
  background: #1E40AF;
  color: #fff;
}

.plan-badge--pro {
  background: var(--color-primary);
  color: #fff;
}

.template-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 991.98px) {
  .template-editor {
    grid-template-columns: 1fr;
  }
}

.template-preview {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: .5rem;
  padding: 1.25rem;
  min-height: 200px;
  white-space: pre-wrap;
  font-size: .9375rem;
  line-height: 1.6;
}

.variable-chip {
  display: inline-block;
  padding: .2rem .5rem;
  margin: .15rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: .25rem;
  font-size: .8125rem;
  font-family: ui-monospace, monospace;
  color: var(--color-text-muted);
}

.code-block {
  background: var(--color-hero-bg);
  color: #E2E8F0;
  border-radius: .5rem;
  padding: 1rem;
  font-size: .8125rem;
  overflow-x: auto;
  font-family: ui-monospace, monospace;
}

.qr-placeholder {
  width: 200px;
  height: 200px;
  margin: 0 auto;
  background:
    linear-gradient(45deg, #E2E8F0 25%, transparent 25%),
    linear-gradient(-45deg, #E2E8F0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #E2E8F0 75%),
    linear-gradient(-45deg, transparent 75%, #E2E8F0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  border: 2px dashed var(--color-border);
  border-radius: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: .875rem;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline li {
  position: relative;
  padding-left: 1.75rem;
  padding-bottom: 1rem;
  border-left: 2px solid var(--color-border);
  margin-left: .5rem;
}

.timeline li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -.4rem;
  top: .25rem;
  width: .65rem;
  height: .65rem;
  border-radius: 50%;
  background: var(--color-primary);
}

.timeline li.muted::before {
  background: var(--color-border);
}

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

.quick-link-card {
  display: block;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .2s ease;
}

.quick-link-card:hover {
  box-shadow: var(--shadow-card-hover);
  color: inherit;
}

.quick-link-card i {
  font-size: 1.5rem;
  color: var(--color-primary);
  margin-bottom: .5rem;
  display: block;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    display: none;
  }
  .app-shell--mobile-nav .app-sidebar-offcanvas {
    width: 260px;
  }
}
