
/* =====================================================================
   CLOVER NIGHT — ONBOARDING SYSTEM
   Design system basado en la identidad de Andrés Rangel
   Fonts: Anton (display) + Inter (body) vía Google Fonts
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Anton&family=Inter:wght@400;500;600;700;800&display=swap');

/* ── TOKENS ─────────────────────────────────────────────────────────── */
:root {
  --orange:        #F26B1F;
  --orange-bright: #FF8327;
  --orange-deep:   #C84F0F;
  --orange-glow:   rgba(242,107,31,0.15);

  --ink:           #0E0E0E;
  --ink-soft:      #2B2520;
  --brown:         #3F2A1E;

  --cream:         #F2E8DC;
  --cream-soft:    #FAF5EE;
  --white:         #FFFFFF;

  --gray:          #9B9590;
  --border:        #E5DDD3;
  --border-focus:  var(--orange);

  --dark-bg:       #0A0807;
  --dark-bg2:      #141110;
  --dark-line:     #2A211C;

  --shadow-sm:     0 2px 8px rgba(20,14,10,0.07);
  --shadow-md:     0 8px 24px rgba(20,14,10,0.09);
  --shadow-lg:     0 24px 64px rgba(20,14,10,0.13);
  --shadow-orange: 0 8px 24px rgba(242,107,31,0.22);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --font-display: 'Anton', 'Impact', sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
}

/* ── RESET ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream-soft);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── TYPOGRAPHY ─────────────────────────────────────────────────────── */
.display {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--orange);
  display: block;
}
h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
h2 { font-size: clamp(20px, 2.6vw, 28px); font-weight: 700; letter-spacing: -0.015em; }
h3 { font-size: 18px; font-weight: 700; }
h4 { font-size: 15px; font-weight: 600; }

/* ── LAYOUT ─────────────────────────────────────────────────────────── */
.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 780px; margin: 0 auto; padding: 0 24px; }

/* ── NAVBAR ─────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250,245,238,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.nav__inner {
  max-width: 1140px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  height: 60px;
}
.nav__brand {
  display: flex; flex-direction: column; gap: 1px;
  text-decoration: none; flex-shrink: 0;
}
.nav__brand-name {
  font-family: var(--font-display);
  font-size: 19px; color: var(--ink);
  text-transform: uppercase; letter-spacing: 0.02em;
  line-height: 1;
}
.nav__brand-tag {
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.4em; color: var(--orange);
  text-transform: uppercase;
}
.nav__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav__status {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-soft);
}
.nav__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── BUTTONS ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--font-body); font-weight: 700; font-size: 14px;
  padding: 11px 20px; border-radius: var(--r-md); border: none;
  cursor: pointer; text-decoration: none;
  transition: all 160ms ease-out; letter-spacing: 0.01em;
  white-space: nowrap;
}
.btn--primary {
  background: var(--orange); color: #fff;
  box-shadow: var(--shadow-orange);
}
.btn--primary:hover { background: var(--orange-deep); box-shadow: 0 12px 28px rgba(242,107,31,0.3); }
.btn--primary:active { transform: scale(0.97); }

.btn--ghost {
  background: transparent; color: var(--ink);
  border: 1.5px solid var(--border);
}
.btn--ghost:hover { border-color: var(--orange); color: var(--orange); }

.btn--dark {
  background: var(--ink); color: #fff;
}
.btn--dark:hover { background: var(--brown); }

.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--lg { padding: 14px 26px; font-size: 15px; }
.btn--full { width: 100%; }

.btn--loading { opacity: 0.7; pointer-events: none; }
.btn--loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── CARDS ───────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
}
.card--cream {
  background: var(--cream-soft);
}
.card--dark {
  background: var(--dark-bg2);
  border-color: var(--dark-line);
  color: #fff;
}
.card--hover {
  transition: transform 200ms, box-shadow 200ms, border-color 200ms;
}
.card--hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(242,107,31,0.3);
}

/* ── FORMS ───────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.field__label span.req { color: var(--orange); margin-left: 3px; }
.field__hint { font-size: 12px; color: var(--gray); margin-top: -2px; }

.input, .textarea, select {
  width: 100%;
  font-family: var(--font-body); font-size: 14px;
  color: var(--ink); background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 14px;
  transition: border-color 160ms, box-shadow 160ms;
  resize: vertical;
  line-height: 1.5;
}
.input:focus, .textarea:focus, select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-glow);
}
.input::placeholder, .textarea::placeholder {
  color: var(--gray);
  opacity: 0.7;
  font-style: italic;
}
.textarea { min-height: 80px; }

/* ── PROGRESS BAR ────────────────────────────────────────────────────── */
.progress-track {
  height: 6px; background: var(--border);
  border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--orange);
  border-radius: 999px;
  transition: width 500ms ease-out;
}
.progress-label {
  font-size: 12px; font-weight: 700;
  color: var(--orange);
}

/* ── SECTION TABS ────────────────────────────────────────────────────── */
.section-tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.section-tabs::-webkit-scrollbar { display: none; }

.section-tab {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 12px 18px;
  font-size: 12px; font-weight: 600; color: var(--gray);
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 160ms;
  background: none; border-left: none; border-right: none; border-top: none;
  font-family: var(--font-body);
}
.section-tab:hover { color: var(--ink); }
.section-tab.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}
.section-tab .tab-num {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  background: var(--border); color: var(--gray);
  transition: background 160ms, color 160ms;
  flex-shrink: 0;
}
.section-tab.active .tab-num,
.section-tab.done .tab-num {
  background: var(--orange); color: #fff;
}
.section-tab.done { color: var(--ink-soft); }

/* ── TABLE (PPM Características) ─────────────────────────────────────── */
.ppm-table { width: 100%; border-collapse: collapse; }
.ppm-table thead th {
  text-align: left; padding: 10px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--orange);
  border-bottom: 2px solid var(--orange);
  background: none;
}
.ppm-table tbody td { padding: 8px 6px; vertical-align: top; }
.ppm-table tbody tr { border-bottom: 1px solid var(--border); }
.ppm-table .input { font-size: 13px; padding: 8px 10px; }

/* ── BADGES ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge--proceso  { background: #FFF3E0; color: #E65100; border: 1px solid #FFCC80; }
.badge--completado { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.badge--pausado  { background: #F3F3F3; color: #616161; border: 1px solid #BDBDBD; }

/* ── AUTOSAVE INDICATOR ──────────────────────────────────────────────── */
.autosave {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--gray);
  padding: 5px 10px; border-radius: 999px;
  background: var(--cream); border: 1px solid var(--border);
  transition: all 200ms;
}
.autosave.saving { color: var(--orange); border-color: var(--orange); }
.autosave.saved  { color: #22c55e; border-color: #86efac; }
.autosave.error  { color: #ef4444; border-color: #fca5a5; }
.autosave__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.autosave.saving .autosave__dot { animation: spin 0.8s linear infinite; background: none; border: 2px solid var(--orange); border-top-color: transparent; border-radius: 50%; }

/* ── LOGIN SCREEN ────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--dark-bg);
  padding: 24px;
}
.login-card {
  background: var(--dark-bg2);
  border: 1px solid var(--dark-line);
  border-radius: var(--r-xl);
  padding: 40px 36px;
  width: 100%; max-width: 420px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.4);
}
.login-card .eyebrow { margin-bottom: 8px; }
.login-card h1 { color: #fff; font-size: 28px; margin-bottom: 6px; }
.login-card p  { color: rgba(255,255,255,0.6); font-size: 14px; margin-bottom: 28px; }
.login-card .field__label { color: rgba(255,255,255,0.85); }
.login-card .input {
  background: rgba(255,255,255,0.05);
  border-color: var(--dark-line);
  color: #fff;
}
.login-card .input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(242,107,31,0.18);
}
.login-card .input::placeholder { color: rgba(255,255,255,0.35); font-style: normal; }
.login-err {
  font-size: 13px; color: #fca5a5;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--r-sm); padding: 10px 12px;
  display: none;
}
.login-err.show { display: block; }

/* ── DASHBOARD ───────────────────────────────────────────────────────── */
.dash-header {
  background: var(--dark-bg);
  padding: 48px 0 36px;
}
.dash-header .container { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.dash-header h1 { color: #fff; }
.dash-header p  { color: rgba(255,255,255,0.6); font-size: 14px; margin-top: 4px; }

.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  background: var(--dark-bg);
  padding-bottom: 40px;
}
.dash-stat {
  background: var(--dark-bg2);
  border: 1px solid var(--dark-line);
  border-radius: var(--r-lg); padding: 20px 24px;
}
.dash-stat__num {
  font-family: var(--font-display);
  font-size: 48px; color: var(--orange);
  line-height: 1; letter-spacing: -0.01em;
}
.dash-stat__lbl { color: rgba(255,255,255,0.6); font-size: 13px; margin-top: 5px; }

.dash-tools {
  padding: 28px 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.dash-tools .search {
  flex: 1; min-width: 240px;
  display: flex; align-items: center; gap: 8px;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--r-md); padding: 9px 14px;
}
.dash-tools .search input {
  border: none; outline: none; font-size: 14px;
  font-family: var(--font-body); color: var(--ink);
  background: transparent; width: 100%;
}
.dash-tools .search svg { color: var(--gray); flex-shrink: 0; }

/* ── CLIENT TABLE ────────────────────────────────────────────────────── */
.client-table { width: 100%; border-collapse: collapse; }
.client-table thead th {
  text-align: left; padding: 12px 14px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gray); border-bottom: 2px solid var(--border);
}
.client-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 120ms;
  cursor: pointer;
}
.client-table tbody tr:hover { background: var(--cream-soft); }
.client-table tbody td { padding: 14px 14px; font-size: 14px; }
.client-table .prog-cell { display: flex; align-items: center; gap: 10px; }
.client-table .prog-mini { flex: 1; max-width: 80px; }

/* ── CLIENT DETAIL PANEL ─────────────────────────────────────────────── */
.detail-panel {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: stretch;
  pointer-events: none; opacity: 0;
  transition: opacity 220ms;
}
.detail-panel.open { pointer-events: all; opacity: 1; }
.detail-overlay {
  position: absolute; inset: 0;
  background: rgba(14,10,8,0.55);
  backdrop-filter: blur(4px);
}
.detail-drawer {
  position: relative; z-index: 1;
  margin-left: auto;
  width: min(640px, 96vw);
  background: var(--white);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.32,0,0.67,0);
  display: flex; flex-direction: column;
}
.detail-panel.open .detail-drawer {
  transform: translateX(0);
  transition-timing-function: cubic-bezier(0.33,1,0.68,1);
}
.detail-drawer__head {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px;
  position: sticky; top: 0; background: var(--white); z-index: 2;
}
.detail-drawer__body { padding: 24px 28px; flex: 1; }
.detail-drawer__footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; flex-wrap: wrap;
  position: sticky; bottom: 0; background: var(--white);
}
.detail-section {
  margin-bottom: 28px;
}
.detail-section h4 {
  font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--orange); margin-bottom: 12px;
  font-family: var(--font-display);
}
.detail-qa { margin-bottom: 14px; }
.detail-qa__q { font-size: 12px; font-weight: 600; color: var(--gray); margin-bottom: 4px; }
.detail-qa__a {
  font-size: 14px; color: var(--ink-soft);
  background: var(--cream-soft); border-radius: var(--r-sm);
  padding: 10px 12px; white-space: pre-wrap; line-height: 1.5;
}
.detail-qa__a.empty { color: var(--gray); font-style: italic; }

/* ── CLIENT ONBOARDING FORM ──────────────────────────────────────────── */
.onboarding-hero {
  background: var(--dark-bg);
  padding: 36px 0 32px;
}
.onboarding-hero .container {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.onboarding-hero__text { flex: 1; }
.onboarding-hero__name { color: #fff; margin-bottom: 4px; }
.onboarding-hero__sub  { color: rgba(255,255,255,0.6); font-size: 14px; }

.onboarding-tabs {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 60px; z-index: 30;
}

.section-content { padding: 32px 0 64px; }
.section-form {
  display: flex; flex-direction: column; gap: 20px;
  display: none;
}
.section-form.active { display: flex; }

.section-intro {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px 20px;
  font-size: 14px; color: var(--ink-soft);
  margin-bottom: 4px;
}

.form-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 0 0; border-top: 1px solid var(--border); margin-top: 8px;
}

/* ── PPM TABLE WRAPPER ───────────────────────────────────────────────── */
.ppm-wrap {
  background: var(--cream-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px;
  overflow-x: auto;
}
.ppm-wrap h4 { margin-bottom: 14px; font-size: 13px; color: var(--ink); }
.add-row-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; font-size: 13px; font-weight: 600;
  color: var(--orange); background: none; border: none; cursor: pointer;
  padding: 6px 0;
  font-family: var(--font-body);
}
.add-row-btn:hover { color: var(--orange-deep); }

/* ── CONGRATS SCREEN ─────────────────────────────────────────────────── */
.congrats-wrap {
  min-height: 60vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 24px; text-align: center;
}
.congrats-card {
  max-width: 560px; padding: 48px 40px;
}
.congrats-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--orange); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin: 0 auto 24px;
  box-shadow: var(--shadow-orange);
}
.congrats-card h2 { margin-bottom: 16px; }
.congrats-card p  { color: var(--ink-soft); line-height: 1.65; }

/* ── MODAL ───────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(14,10,8,0.6); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--r-xl); padding: 36px 32px;
  max-width: 480px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modal-in 240ms cubic-bezier(0.33,1,0.68,1);
}
@keyframes modal-in { from { transform:translateY(14px); opacity:0 } to { transform:none; opacity:1 } }
.modal h3 { margin-bottom: 6px; }
.modal p  { color: var(--ink-soft); font-size: 14px; margin-bottom: 22px; }
.modal .form-fields { display: flex; flex-direction: column; gap: 14px; }
.modal .modal-actions { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--cream); border: none; cursor: pointer;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  color: var(--gray);
}
.modal-close:hover { color: var(--ink); }

/* ── TOASTS ──────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff;
  padding: 12px 16px; border-radius: var(--r-md);
  font-size: 14px; box-shadow: var(--shadow-lg);
  animation: toast-in 220ms cubic-bezier(0.33,1,0.68,1);
  max-width: 320px;
}
.toast.success { background: #166534; }
.toast.error   { background: #991b1b; }
@keyframes toast-in { from { transform:translateX(24px); opacity:0 } to { transform:none; opacity:1 } }

/* ── EMPTY STATE ─────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 64px 24px; color: var(--gray);
}
.empty-state p { margin-top: 8px; font-size: 14px; }

/* ── LOADING ─────────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--dark-bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
}
.loading-spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(242,107,31,0.25);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-overlay p { color: rgba(255,255,255,0.6); font-size: 14px; }
.loading-overlay.hidden { display: none; }

/* ── RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .dash-stats { grid-template-columns: 1fr 1fr; }
  .dash-header .container { flex-direction: column; align-items: flex-start; }
  .detail-drawer { width: 100vw; }
  .login-card { padding: 28px 22px; }
  .section-tab { padding: 10px 12px; font-size: 11px; }
  .onboarding-hero { padding: 24px 0; }
  .modal { padding: 28px 22px; }
  .client-table thead { display: none; }
  .client-table tbody td { display: block; padding: 6px 14px; }
  .client-table tbody td:first-child { padding-top: 14px; }
  .client-table tbody td:last-child  { padding-bottom: 14px; }
  .client-table tbody td[data-label]::before {
    content: attr(data-label) ': ';
    font-weight: 600; color: var(--gray); font-size: 11px; display: block;
  }
}

@media (max-width: 480px) {
  .dash-stats { grid-template-columns: 1fr; }
  .ppm-table  { font-size: 12px; }
}

