/* ══════════════════════════════════════════════════════════════
   ARED Connect — Portal del Cliente
   Mismo sistema de diseño que el panel admin
   ══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

:root {
  --navy:        #1a2340;
  --navy-dark:   #0d1526;
  --navy-mid:    #243060;
  --gold:        #c8782a;
  --gold-light:  #e8962e;
  --gold-pale:   #f0b860;
  --white:       #ffffff;
  --off-white:   #f5f7fc;
  --gray:        #8a92a8;
  --gray-light:  #e8ecf4;
  --text:        #1a2340;
  --text-muted:  #6b748a;
  --border:      rgba(26,35,64,.1);
  --bg:          #f5f7fc;
  --bg-card:     #ffffff;
  --success:     #22a159;
  --success-bg:  #e8f7ef;
  --danger:      #e03e3e;
  --danger-bg:   #fdeaea;
  --warning:     #d97706;
  --warning-bg:  #fef3c7;
  --info:        #2563eb;
  --info-bg:     #eff6ff;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 2px 12px rgba(26,35,64,.08);
  --shadow-md:   0 8px 30px rgba(26,35,64,.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
h1,h2,h3,h4,h5 { font-family: 'Syne', sans-serif; line-height: 1.2; }
a { text-decoration: none; color: inherit; }

/* ── NAVBAR ── */
.portal-nav {
  background: var(--navy);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.2);
}
.nav-brand { display: flex; align-items: center; gap: .75rem; }
.nav-brand img { height: 36px; width: 36px; object-fit: contain; }
.nav-brand-text .brand { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1rem; color: var(--white); display: block; }
.nav-brand-text .sub { font-size: .62rem; color: var(--gold-pale); letter-spacing: .1em; text-transform: uppercase; }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-client { display: flex; align-items: center; gap: .6rem; }
.nav-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg,var(--gold),var(--gold-light)); display: flex; align-items: center; justify-content: center; font-family: 'Syne',sans-serif; font-weight: 800; font-size: .9rem; color: var(--white); flex-shrink: 0; }
.nav-client-name { font-size: .85rem; font-weight: 600; color: var(--white); }
.nav-client-code { font-size: .72rem; color: var(--gold-pale); }
.nav-logout { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); color: rgba(255,255,255,.7); padding: .4rem .9rem; border-radius: 50px; font-size: .82rem; font-weight: 500; transition: all .2s; cursor: pointer; }
.nav-logout:hover { background: rgba(255,255,255,.15); color: var(--white); }

/* ── BOTTOM NAV (móvil) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--navy);
  padding: .6rem 0 calc(.6rem + env(safe-area-inset-bottom));
  z-index: 100;
  border-top: 1px solid rgba(255,255,255,.08);
}
.bottom-nav-items { display: flex; justify-content: space-around; }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: .25rem .75rem; color: rgba(255,255,255,.45); font-size: .65rem; font-weight: 500; transition: color .2s; cursor: pointer; text-decoration: none; }
.bottom-nav-item i { font-size: 1.2rem; }
.bottom-nav-item.active { color: var(--gold-light); }

/* ── LAYOUT ── */
.portal-content { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem 5rem; }

/* ── CARDS ── */
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border); }
.card-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1rem; color: var(--navy); display: flex; align-items: center; gap: .5rem; }

/* ── KPI GRID ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
  width: 100%;
}
.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  overflow: hidden;
}
.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.kpi-icon--navy    { background: rgba(26,35,64,.08);  color: var(--navy); }
.kpi-icon--gold    { background: rgba(200,120,42,.12); color: var(--gold); }
.kpi-icon--success { background: var(--success-bg);    color: var(--success); }
.kpi-icon--danger  { background: var(--danger-bg);     color: var(--danger); }
.kpi-icon--info    { background: var(--info-bg);       color: var(--info); }
.kpi-label {
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value {
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  white-space: nowrap;
}
.kpi-value--success { color: var(--success); }
.kpi-value--danger  { color: var(--danger); }
.kpi-value--gold    { color: var(--gold); }
.kpi-sub {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  body { overflow-x: hidden; }
  .portal-content { padding: 1rem .75rem 5rem; overflow-x: hidden; }
  .kpi-grid { gap: .5rem; grid-template-columns: 1fr; }
  .kpi-card { padding: .85rem .65rem; gap: .5rem; }
  .kpi-icon { width: 34px; height: 34px; font-size: .9rem; }
  .kpi-value { font-size: 1.1rem; }
}

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 50px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.badge::before { content: '•'; font-size: .6rem; }
.badge--pagado    { background: #e8f7ef; color: #22a159; }
.badge--pendiente { background: #fef3c7; color: #d97706; }
.badge--activo    { background: #e8f7ef; color: #22a159; }
.badge--suspendido{ background: #fdeaea; color: #e03e3e; }
.badge--info      { background: var(--info-bg); color: var(--info); }
.badge--warning   { background: var(--warning-bg); color: var(--warning); }
.badge--abierto   { background: var(--info-bg); color: var(--info); }
.badge--cerrado   { background: var(--success-bg); color: var(--success); }
.badge--en_proceso{ background: var(--warning-bg); color: var(--warning); }

/* ── TABLA ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead th { background: var(--off-white); color: var(--text-muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; padding: .65rem .85rem; text-align: left; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--off-white); }
tbody td { padding: .75rem .85rem; vertical-align: middle; color: var(--text); }

/* ── FORMULARIOS ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: .78rem; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .05em; }
.form-input { padding: .75rem 1rem; border: 1.5px solid var(--gray-light); border-radius: var(--radius-sm); font-family: 'DM Sans', sans-serif; font-size: .95rem; color: var(--text); background: var(--white); outline: none; transition: border-color .2s; width: 100%; }
.form-input:focus { border-color: var(--gold); }
textarea.form-input { resize: vertical; min-height: 100px; }
.form-hint { font-size: .75rem; color: var(--text-muted); }

/* ── BOTONES ── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .65rem 1.25rem; border-radius: var(--radius-sm); font-family: 'DM Sans', sans-serif; font-size: .88rem; font-weight: 600; cursor: pointer; border: none; transition: all .2s; text-decoration: none; }
.btn--primary { background: linear-gradient(135deg,var(--gold),var(--gold-light)); color: var(--white); box-shadow: 0 4px 14px rgba(200,120,42,.35); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(200,120,42,.5); }
.btn--outline { background: transparent; color: var(--navy); border: 1.5px solid var(--gray-light); }
.btn--outline:hover { border-color: var(--gold); color: var(--gold); }
.btn--navy { background: var(--navy); color: var(--white); }
.btn--sm { padding: .45rem .9rem; font-size: .82rem; }
.btn--full { width: 100%; justify-content: center; }

/* ── FLASH ── */
.flash-msg { display: flex; align-items: center; gap: .75rem; padding: .9rem 1.25rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-weight: 600; font-size: .9rem; }
.flash--success { background: var(--success-bg); color: var(--success); }
.flash--error   { background: var(--danger-bg);  color: var(--danger); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 2.5rem; opacity: .3; display: block; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; }

/* ── RACHA BAR ── */
.racha-bar { display: flex; gap: 6px; margin: .75rem 0; }
.racha-dot { width: 32px; height: 8px; border-radius: 4px; background: var(--gray-light); transition: background .3s; }
.racha-dot.filled { background: linear-gradient(90deg,var(--gold),var(--gold-light)); }
.racha-dot.next   { background: linear-gradient(90deg,var(--gold-pale),var(--gold-light)); opacity: .5; }

/* ── UTILIDADES ── */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: .5rem; }
.text-muted { color: var(--text-muted); }
.text-gold   { color: var(--gold); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.fw-bold { font-weight: 700; }
.text-center { text-align: center; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  body { overflow-x: hidden; }
  .portal-content { padding: 1rem .75rem 5rem; overflow-x: hidden; }
  .kpi-grid { gap: .5rem; }
  .kpi-card { padding: .85rem .65rem; gap: .5rem; }
  .kpi-icon { width: 34px; height: 34px; font-size: .9rem; }
  .kpi-value { font-size: 1.1rem; }
}
