/* ===================================================
   SantaApp Contratos — Estilos Principales
   Export Sales Made Easy, S.L.
   =================================================== */

:root {
  /* ── SANTACLOCK BRAND: Grises + Amarillo ── */
  --primary: #F5C518;          /* Amarillo SantaClock */
  --primary-dark: #1C1C1E;     /* Negro/gris muy oscuro */
  --primary-light: #F7D14E;    /* Amarillo claro */
  --primary-xlight: #FEF9E7;   /* Amarillo muy suave */
  --accent: #E6B800;           /* Amarillo oscuro/dorado */
  --text-dark: #1C1C1E;        /* Negro suave */
  --text-mid: #3A3A3C;         /* Gris oscuro */
  --text-light: #6B6B6E;       /* Gris medio */
  --white: #FFFFFF;
  --gray-50: #F8F8F8;
  --gray-100: #F2F2F2;
  --gray-200: #E8E8E8;
  --gray-300: #D0D0D0;
  --border: #E0E0E0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.08), 0 10px 10px rgba(0,0,0,0.03);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Status colors */
  --status-borrador: #6B6B6E;
  --status-enviado: #3B82F6;
  --status-firmado: #F5C518;
  --status-pendiente: #EF4444;
  --status-pagado: #16A34A;
  --status-activo: #1C1C1E;
  --status-cancelado: #DC2626;
}

/* ===================================================
   DARK MODE — variables sobreescritas
   =================================================== */
[data-theme="dark"] {
  --primary: #F5C518;
  --primary-dark: #F5C518;
  --primary-light: #F7D14E;
  --primary-xlight: #2A2500;
  --accent: #E6B800;

  --text-dark: #F0F0F0;
  --text-mid: #C0C0C0;
  --text-light: #8A8A8E;

  --white: #1C1C1E;
  --gray-50: #111113;
  --gray-100: #1C1C1E;
  --gray-200: #2C2C2E;
  --gray-300: #3A3A3C;
  --border: #3A3A3C;

  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.5), 0 4px 6px rgba(0,0,0,0.3);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.5), 0 10px 10px rgba(0,0,0,0.3);
}

/* Superficies base en dark */
[data-theme="dark"] body              { background: var(--gray-50); color: var(--text-dark); }
[data-theme="dark"] .main-header      { background: #1C1C1E; border-color: var(--border); }
[data-theme="dark"] .main-footer      { background: #1C1C1E; border-color: var(--border); color: var(--text-light); }
[data-theme="dark"] .main-footer a    { color: var(--text-light); }
[data-theme="dark"] .card             { background: #1C1C1E; border-color: var(--border); }
[data-theme="dark"] .form-control     { background: #2C2C2E; border-color: var(--border); color: var(--text-dark); }
[data-theme="dark"] .form-control::placeholder { color: var(--text-light); }
[data-theme="dark"] .btn-ghost        { color: var(--text-mid); border-color: var(--border); }
[data-theme="dark"] .btn-ghost:hover  { background: #2A2500; color: var(--primary); border-color: var(--primary); }
[data-theme="dark"] .btn-outline      { color: var(--text-dark); border-color: var(--border); }
[data-theme="dark"] .btn-outline:hover:not(:disabled) { background: #2A2500; border-color: var(--primary); color: var(--primary); }
[data-theme="dark"] .nav-link         { color: var(--text-mid); }
[data-theme="dark"] .nav-link:hover   { color: var(--text-dark); }

/* Sidebar dark */
[data-theme="dark"] .sidebar             { background: #161618; border-color: #2C2C2E; }
[data-theme="dark"] .sidebar-logo        { border-color: #2C2C2E; }
[data-theme="dark"] .sidebar-logo .logo-text strong { color: #F0F0F0; }
[data-theme="dark"] .sidebar-logo .logo-text span   { color: #8A8A8E; }
[data-theme="dark"] .sidebar-logo .logo-icon        { background: #2A2500; color: #F5C518; }
[data-theme="dark"] .sidebar-section-title          { color: #555558; }
[data-theme="dark"] .sidebar-item        { color: #A0A0A4; }
[data-theme="dark"] .sidebar-item:hover  { background: #2C2C2E; color: #F0F0F0; }
[data-theme="dark"] .sidebar-item.active { background: #2C2C2E; color: #F5C518; box-shadow: none; }
[data-theme="dark"] .sidebar-footer      { border-color: #2C2C2E; }
[data-theme="dark"] .sidebar-group-label { color: #555558; }
[data-theme="dark"] .sidebar-group-chevron { color: #555558; }
[data-theme="dark"] .sidebar-section + .sidebar-section { border-color: #2C2C2E; }

/* Kanban, login, contrato y otros fondos blancos en dark */
[data-theme="dark"] .kanban-card         { background: #1C1C1E; border-color: #3A3A3C; }
[data-theme="dark"] .kanban-column       { background: #161618; }
[data-theme="dark"] .login-card          { background: #1C1C1E; border: 1px solid #3A3A3C; }
[data-theme="dark"] .contract-doc        { background: #1C1C1E; border-color: #3A3A3C; color: var(--text-dark); }
[data-theme="dark"] .stripe-card-element { background: #2C2C2E; border-color: #3A3A3C; color: var(--text-dark); }

/* Admin panel dark */
[data-theme="dark"] .admin-topbar     { background: #1C1C1E; border-color: var(--border); }
[data-theme="dark"] .admin-topbar h1  { color: var(--text-dark); }
[data-theme="dark"] .admin-content    { background: var(--gray-50); }
[data-theme="dark"] .admin-layout     { background: var(--gray-50); }

/* Tablas dark */
[data-theme="dark"] table             { color: var(--text-dark); }
[data-theme="dark"] th                { background: var(--gray-100); color: var(--text-mid); border-color: var(--border); }
[data-theme="dark"] td                { border-color: var(--border); }
[data-theme="dark"] tr:hover td       { background: var(--gray-100); }

/* Inputs / selects dark */
[data-theme="dark"] select.form-control { background: #2C2C2E; }
[data-theme="dark"] label               { color: var(--text-mid); }

/* ── ÁRBOL DE AFILIADOS — Drag & Drop ── */
.tree-node-card {
  transition: border-color .18s ease, box-shadow .18s ease, transform .15s ease, opacity .15s ease;
  user-select: none;
  -webkit-user-select: none;
}

/* Nodo siendo arrastrado */
[id^="tree-node-"][draggable="true"]:active .tree-node-card {
  cursor: grabbing !important;
}

/* Indicador visual durante drag sobre target */
.tree-node-card.drag-over {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--primary-xlight) !important;
  transform: scale(1.01);
}

/* Nodo origen: semitransparente mientras se arrastra */
.tree-node-dragging {
  opacity: 0.4 !important;
  transform: scale(0.97) !important;
}

/* Tooltip hint "arrastra" en el icono grip */
.tree-grip-handle {
  cursor: grab;
  opacity: 0.4;
  transition: opacity .2s;
}
.tree-grip-handle:hover { opacity: 1; }

[data-theme="dark"] .tree-node-card.drag-over {
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.25) !important;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--text-dark);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── LAYOUT ── */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-dark);
  font-size: 18px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-text strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
}

.logo-text span {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 400;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-nav a, .header-nav button.nav-link {
  color: var(--text-mid);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
  background: none;
  border: none;
  cursor: pointer;
}

.header-nav a:hover, .header-nav button.nav-link:hover {
  color: var(--accent);
  background: var(--primary-xlight);
}

/* ── THEME TOGGLE BUTTON ── */
.header-theme-btn,
.sidebar-theme-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.2s;
}
.header-theme-btn:hover,
.sidebar-theme-btn:hover {
  background: #FFFBEB;
  color: var(--primary-dark);
  border-color: var(--primary);
}
[data-theme="dark"] .header-theme-btn:hover,
[data-theme="dark"] .sidebar-theme-btn:hover {
  background: #2A2500;
  color: var(--primary);
  border-color: var(--primary);
}

.main-content {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.main-content.full-width {
  max-width: 100%;
  padding: 0;
}

.main-footer {
  background: #1C1C1E;
  color: rgba(255,255,255,0.6);
  padding: 1.5rem;
  text-align: center;
  font-size: 13px;
}

.main-footer a {
  color: var(--primary);
  text-decoration: none;
}

.main-footer a:hover {
  text-decoration: underline;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: var(--font);
  line-height: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-dark);
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--text-dark);
  border-color: var(--gray-300);
}

.btn-outline:hover:not(:disabled) {
  background: #FFFBEB;
  border-color: var(--primary);
  color: var(--primary-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: #FFFBEB;
  color: var(--primary-dark);
  border-color: var(--primary);
}

.btn-danger {
  background: #EF4444;
  color: white;
  border-color: #EF4444;
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: 10px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-icon {
  padding: 8px;
  border-radius: 6px;
}

/* ── CARDS ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card-hover {
  transition: all 0.2s;
  cursor: pointer;
}

.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}

/* ── FORMS ── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.form-label .required {
  color: #EF4444;
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text-dark);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.18);
}

.form-control::placeholder {
  color: var(--text-light);
}

.form-control.error {
  border-color: #EF4444;
}

.form-error {
  font-size: 12px;
  color: #EF4444;
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-checkbox label {
  font-size: 14px;
  color: var(--text-mid);
  cursor: pointer;
  line-height: 1.5;
}

.form-checkbox label a {
  color: var(--primary);
  font-weight: 500;
}

/* ── BADGES / STATUS ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-green { background: #DCFCE7; color: #15803D; }
.badge-blue { background: #DBEAFE; color: #1D4ED8; }
.badge-yellow { background: #FEF3C7; color: #D97706; }
.badge-red { background: #FEE2E2; color: #DC2626; }
.badge-gray { background: #F3F4F6; color: #6B7280; }
.badge-purple { background: #EDE9FE; color: #7C3AED; }
.badge-primary { background: var(--primary-xlight); color: var(--accent); }

/* ── STEPPER ── */
.stepper {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.step {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.step-circle {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--border);
  background: var(--white);
  color: var(--text-light);
  transition: all 0.3s;
}

.step.active .step-circle {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-dark);
}

.step.completed .step-circle {
  border-color: var(--accent);
  background: var(--primary-xlight);
  color: var(--accent);
}

.step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-left: 8px;
  white-space: nowrap;
}

.step.active .step-label {
  color: var(--accent);
}

.step.completed .step-label {
  color: var(--text-mid);
}

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
  transition: background 0.3s;
}

.step-connector.completed {
  background: var(--primary);
}

/* ── PRICING CARDS ── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.pricing-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.pricing-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-xl);
  transform: translateY(-3px);
}

.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(245, 197, 24, 0.15);
}

.pricing-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--primary);
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pricing-card .plan-name {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-mid);
  margin-bottom: 0.5rem;
}

.pricing-card .plan-users {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.pricing-card .plan-price {
  margin-bottom: 1.25rem;
}

.pricing-card .plan-price .amount {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}

.pricing-card .plan-price .currency {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-mid);
  vertical-align: top;
  margin-top: 6px;
  display: inline-block;
}

.pricing-card .plan-price .period {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 2px;
}

.pricing-card .plan-features {
  list-style: none;
  margin-bottom: 1.5rem;
  flex: 1;
}

.pricing-card .plan-features li {
  font-size: 13px;
  color: var(--text-mid);
  padding: 4px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.pricing-card .plan-features li::before {
  content: "✓";
  color: var(--accent);
  font-weight: 700;
  min-width: 16px;
}

/* ── TABLE ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--text-dark);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--gray-50);
}

/* ── ALERT / NOTIFICATION ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  margin-bottom: 1rem;
}

.alert-success { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.alert-error { background: #FEE2E2; color: #DC2626; border: 1px solid #FECACA; }
.alert-warning { background: #FEF3C7; color: #D97706; border: 1px solid #FDE68A; }
.alert-info { background: #DBEAFE; color: #1D4ED8; border: 1px solid #BFDBFE; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── ADMIN LAYOUT ── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  min-width: 240px;
  background: #F4F5F7;
  border-right: 1px solid #E2E4E9;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #E2E4E9;
}

.sidebar-logo .logo-text strong { color: var(--text-dark); }
.sidebar-logo .logo-text span { color: var(--text-light); }
.sidebar-logo .logo-icon { background: var(--primary-xlight); color: var(--primary); }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-section {
  padding: 0 0.75rem;
  margin-bottom: 0.25rem;
}

.sidebar-section + .sidebar-section {
  border-top: 1px solid #E9EBF0;
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

[data-theme="dark"] .sidebar-section + .sidebar-section {
  border-color: #2C2C2E;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #9BA3AF;
  padding: 8px 12px 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #4B5563;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.sidebar-item:hover {
  background: #E9EBF0;
  color: var(--text-dark);
}

.sidebar-item.active {
  background: var(--white);
  color: var(--primary-dark);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.sidebar-item i {
  width: 18px;
  font-size: 14px;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #E2E4E9;
}

/* ── Sidebar acordeón ─────────────────────────────── */
.sidebar-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 5px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
  user-select: none;
}
.sidebar-group-header:hover {
  background: #E9EBF0;
}
[data-theme="dark"] .sidebar-group-header:hover {
  background: #2C2C2E;
}
.sidebar-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #9BA3AF;
}
.sidebar-group-chevron {
  font-size: 9px;
  color: #9BA3AF;
  transition: transform 0.22s ease;
}
.sidebar-group.open .sidebar-group-chevron {
  transform: rotate(90deg);
}
.sidebar-group-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  opacity: 0;
}
.sidebar-group.open .sidebar-group-body {
  max-height: 400px;
  opacity: 1;
}
/* Sección sin label (Dashboard) no tiene acorde\u00f3n */
.sidebar-section-solo {
  padding: 0 0.75rem;
  margin-bottom: 0.25rem;
}

.admin-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 3rem;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.admin-topbar h1 {
  font-size: 18px;
  font-weight: 700;
}

.admin-content {
  flex: 1;
  padding: 2.5rem 3rem;
}

/* ── KANBAN ── */
.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-col {
  min-width: 240px;
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  padding: 0;
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-col-body {
  padding: 8px;
  flex: 1;
  min-height: 100px;
}

.kanban-card {
  background: var(--white);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.kanban-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.kanban-card h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.kanban-card p {
  font-size: 12px;
  color: var(--text-light);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── CONTRACT PREVIEW ── */
.contract-doc {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 720px;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.7;
}

.contract-doc h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
  text-align: center;
  margin-bottom: 0.25rem;
}

.contract-doc .contract-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 12px;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--primary-xlight);
}

.contract-doc .contract-section {
  margin-bottom: 1.25rem;
}

.contract-doc .contract-section h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--primary-xlight);
}

.contract-doc .contract-section p {
  color: var(--text-mid);
  font-size: 13px;
}

.contract-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.signature-box {
  text-align: center;
}

.signature-box .sig-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 8px;
}

.signature-box .sig-area {
  height: 80px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signature-box .sig-info {
  font-size: 11px;
  color: var(--text-light);
}

/* ── SIGNATURE CANVAS ── */
.sig-canvas-wrapper {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--gray-50);
  overflow: hidden;
  position: relative;
}

.sig-canvas-wrapper canvas {
  display: block;
  width: 100%;
  cursor: crosshair;
  touch-action: none;
}

.sig-canvas-wrapper .sig-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: var(--text-light);
  font-size: 14px;
}

/* ── PAYMENT OPTIONS ── */
.payment-option {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0.75rem;
}

.payment-option:hover {
  border-color: var(--primary-light);
}

.payment-option.selected {
  border-color: var(--primary);
  background: var(--primary-xlight);
}

/* ── PLAN TOGGLE ── */
.plan-toggle {
  display: inline-flex;
  background: var(--gray-100);
  border-radius: 30px;
  padding: 4px;
  gap: 2px;
  margin: 0 auto 2rem;
}

.plan-toggle-btn {
  padding: 8px 24px;
  border-radius: 24px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  color: var(--text-light);
  font-family: var(--font);
}

.plan-toggle-btn.active {
  background: var(--primary);
  color: var(--primary-dark);
  box-shadow: var(--shadow);
}

.plan-toggle-btn .save-badge {
  background: #16A34A;
  color: white;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 700;
}

.payment-option-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.payment-option-header input[type="radio"] {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
}

.payment-option-header .pay-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary-xlight);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 16px;
}

.payment-option-header .pay-info h4 {
  font-size: 14px;
  font-weight: 600;
}

.payment-option-header .pay-info p {
  font-size: 12px;
  color: var(--text-light);
}

.payment-option-body {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── METRICS CARDS ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.metric-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.metric-icon.green  { background: var(--primary-xlight); color: var(--accent); }
.metric-icon.blue   { background: #DBEAFE; color: #2563EB; }
.metric-icon.yellow { background: #FEF3C7; color: #D97706; }
.metric-icon.red    { background: #FEE2E2; color: #DC2626; }

[data-theme="dark"] .metric-card           { background: #1C1C1E; }
[data-theme="dark"] .metric-icon.green     { background: #1A2A1A; color: #4ADE80; }
[data-theme="dark"] .metric-icon.blue      { background: #1A2040; color: #60A5FA; }
[data-theme="dark"] .metric-icon.yellow    { background: #2A2000; color: #FBBF24; }
[data-theme="dark"] .metric-icon.red       { background: #2A1010; color: #F87171; }

.metric-info h3 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}

.metric-info p {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
}

/* ── PAGE SECTIONS ── */
.page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-header h2 {
  font-size: 24px;
  font-weight: 800;
}

.page-header p {
  color: var(--text-light);
  font-size: 14px;
  margin-top: 6px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

.section-desc {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 1.5rem;
}

/* ── SUCCESS PAGE ── */
.success-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 1.5rem;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: var(--primary-xlight);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--accent);
  margin-bottom: 1.5rem;
  animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
}

.tab:hover {
  color: var(--primary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--primary);
}

/* ── LOGIN ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1C1C1E 0%, #3A3A3C 60%, #F5C518 100%);
  padding: 1.5rem;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-light);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-mid);
}

/* ── DIVIDER ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── PRICE SUMMARY ── */
.price-summary {
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 6px 0;
  color: var(--text-mid);
}

.price-row.total {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-dark);
  border-top: 2px solid var(--border);
  padding-top: 12px;
  margin-top: 6px;
}

/* ── LOADING ── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── TOAST ── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  background: var(--text-dark);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  box-shadow: var(--shadow-xl);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { background: #15803D; }
.toast.error { background: #DC2626; }
.toast.warning { background: #D97706; }
.toast.info { background: #1D4ED8; }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .form-row, .form-row-3 {
    grid-template-columns: 1fr;
  }

  .pricing-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sidebar {
    display: none;
  }

  .main-header {
    padding: 0 1rem;
  }

  .main-content {
    padding: 1rem;
  }

  .contract-doc {
    padding: 1.5rem 1rem;
  }

  .contract-signatures {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .stepper {
    display: none;
  }
}

/* ── STRIPE MOCK ── */
.stripe-card-element {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--white);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-dark);
  cursor: text;
}

.stripe-mock-notice {
  background: var(--primary-xlight);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: #92400E;
  margin-top: 8px;
}

/* ── TOOLTIP ── */
[data-tooltip] {
  position: relative;
}

/* ── PROGRESS BAR ── */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── ANNUAL SAVING TAG ── */
.annual-save {
  background: #DCFCE7;
  color: #15803D;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  margin-top: 4px;
}

/* ── MISC ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 18px; }
.text-primary { color: var(--accent); }
.text-muted { color: var(--text-light); }
.text-danger { color: #EF4444; }
.rounded { border-radius: var(--radius); }
.hidden { display: none !important; }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-bar .form-control {
  width: auto;
  min-width: 160px;
}

/* ── DETAIL GRID ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.detail-item .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.detail-item .value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

/* ── TIMELINE ── */
.timeline {
  list-style: none;
}

.timeline-item {
  display: flex;
  gap: 12px;
  margin-bottom: 1rem;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  min-width: 12px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 5px;
  position: relative;
}

.timeline-dot::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: calc(100% + 8px);
  background: var(--border);
}

.timeline-item:last-child .timeline-dot::after {
  display: none;
}

.timeline-content .time {
  font-size: 11px;
  color: var(--text-light);
}

.timeline-content p {
  font-size: 13px;
  font-weight: 500;
}

/* ── SIDEBAR MOBILE TOGGLE ── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-mid);
  padding: 8px;
}

@media (max-width: 768px) {
  .mobile-menu-btn { display: block; }
}
