/* =====================================================
   CelebraTodo — app.css
   Panel interior: topbar, sidebar, dashboard, login,
   formularios, tablas. Carga DESPUÉS de tokens.css
   ===================================================== */

/* ── TOPBAR ── */
.panel-topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 62px;
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow-xs);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-brand svg {
  width: 26px;
  height: 26px;
  color: var(--gold);
  flex-shrink: 0;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.panel-profile-trigger {
  white-space: nowrap;
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--gold-pale);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  flex-shrink: 0;
  line-height: 1;
}

/* ── LAYOUT PANEL ── */
.app-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  align-items: start;
  min-height: calc(100vh - 62px);
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--navy);
  width: 230px;
  min-height: calc(100vh - 62px);
  padding: 20px 0 32px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 62px;
  height: calc(100vh - 62px);
  overflow-y: auto;
}

.sb-section {
  padding: 0 10px;
  margin-top: 16px;
}

.sb-section:first-child {
  margin-top: 0;
}

.sb-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.28);
  padding: 0 10px;
  margin-bottom: 4px;
  display: block;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  transition: background var(--dur), color var(--dur);
  margin: 1px 0;
  line-height: 1.3;
}

.sidebar a:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.88);
}

.sidebar a.active {
  background: rgba(176,141,60,.20);
  color: #c9a84c;
}

.sidebar a svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: .65;
}

.sidebar a.active svg {
  opacity: 1;
}

.sb-divider {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin: 12px 12px;
}

/* ── MAIN ── */
.main-content {
  padding: 28px 32px;
  background: var(--cream);
  min-height: calc(100vh - 62px);
  min-width: 0;
}

.client-profile-modal[hidden] {
  display: none;
}

.client-profile-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.client-profile-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 29, 52, .52);
  backdrop-filter: blur(4px);
}

.client-profile-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 32px));
  margin: min(8vh, 56px) auto 24px;
  background: linear-gradient(180deg, #fffdf9 0%, #fff7ed 100%);
  border: 1px solid rgba(201, 168, 76, .24);
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(16, 24, 40, .22);
  padding: 24px;
}

.client-profile-modal__dismiss {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(31, 41, 68, .08);
  color: var(--navy);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.client-profile-modal__header {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  padding-right: 36px;
}

.client-profile-modal__eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold);
}

.client-profile-modal__header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.05;
  color: var(--navy);
}

.client-profile-modal__header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.client-profile-form {
  display: grid;
  gap: 14px;
}

.client-profile-form__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.client-profile-form__field {
  display: grid;
  gap: 8px;
}

.client-profile-form__field span {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.client-profile-form__field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(31, 41, 68, .14);
  border-radius: 14px;
  background: rgba(255, 255, 255, .92);
  color: var(--navy);
  padding: 13px 14px;
  font-size: 15px;
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}

.client-profile-form__field input:focus {
  outline: none;
  border-color: rgba(176, 141, 60, .9);
  box-shadow: 0 0 0 4px rgba(201, 168, 76, .16);
  background: var(--white);
}

.client-profile-form__hint {
  margin: -2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.client-profile-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

body.client-profile-modal-open {
  overflow: hidden;
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  color: var(--navy);
  line-height: 1.15;
}

.page-header .sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-xs);
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 21px;
  height: 21px;
}

.ic-gold { background: var(--gold-pale); color: var(--gold); }
.ic-sage { background: var(--sage-pale); color: var(--sage); }
.ic-navy { background: #dde5f0; color: var(--navy); }
.ic-rose { background: var(--rose-pale); color: var(--rose); }

.stat-data strong {
  display: block;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 3px;
}

.stat-data span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ── CARD ── */
.card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--white);
}

.card-header h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  color: var(--navy);
}

.card-body {
  padding: 20px;
}

/* ── TABLA ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 9px 14px;
  background: var(--cream);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-mid);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: var(--cream);
}

.td-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.td-actions a {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--navy);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
  white-space: nowrap;
}

.td-actions a:hover {
  background: var(--cream-mid);
  border-color: var(--gold);
  color: var(--gold);
}

.td-actions a.del {
  color: #b91c1c;
  border-color: rgba(185,28,28,.2);
}

.td-actions a.del:hover {
  background: #fef2f2;
  border-color: #b91c1c;
  color: #b91c1c;
}

/* ── FORMULARIOS PANEL ── */
.form-wrap {
  max-width: 700px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-sep {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
  margin-top: 4px;
}

.form-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 6px;
}

/* ── EMPTY STATE ── */
.empty-box {
  text-align: center;
  padding: 48px 24px;
}

.empty-box svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  color: var(--cream-dark);
  stroke: var(--gold-pale);
}

.empty-box h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  color: var(--text-mid);
  margin-bottom: 6px;
}

.empty-box p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* ── LOGIN / REGISTER ── */
.auth-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.auth-left {
  background: var(--navy);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.auth-left-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.auth-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(88px);
  pointer-events: none;
}

.auth-glow-1 {
  width: 520px;
  height: 520px;
  background: #7b2255;
  opacity: .26;
  top: -160px;
  right: -100px;
}

.auth-glow-2 {
  width: 380px;
  height: 380px;
  background: #9b6e10;
  opacity: .12;
  bottom: -80px;
  left: -40px;
}

.auth-left-content {
  position: relative;
  z-index: 1;
  color: #fff;
  text-align: center;
  max-width: 360px;
}

.auth-ornament {
  font-family: var(--font-display);
  font-size: 72px;
  line-height: 1;
  color: rgba(176,141,60,.3);
  margin-bottom: 18px;
}

.auth-left-content h2 {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 300;
  line-height: 1.1;
  margin-bottom: 14px;
}

.auth-left-content h2 em {
  font-style: italic;
  color: var(--gold-light);
}

.auth-left-content p {
  font-size: 14px;
  color: rgba(255,255,255,.55);
  line-height: 1.75;
}

.auth-right {
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  margin-bottom: 28px;
}

.auth-logo svg {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
  flex: 0 0 28px;
  display: block;
}

.auth-box h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  color: var(--navy);
  margin-bottom: 6px;
  line-height: 1.1;
}

.auth-box .auth-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.auth-alert {
  margin-bottom: 16px;
}

.social-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.social-btn {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow-xs);
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    background var(--dur) var(--ease);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.social-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(176,141,60,.28);
  background: #fffdfa;
}

.social-btn svg {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  min-height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex: 0 0 18px;
  display: block;
}

.social-btn span {
  display: inline-block;
}

.social-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

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

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  border-radius: var(--r-md) !important;
  padding: 13px 24px !important;
  font-size: 13px !important;
  margin-top: 4px;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.auth-links a {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

.auth-links a:hover {
  color: var(--gold);
  text-decoration: underline;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}

.auth-footer a {
  color: var(--gold);
  font-weight: 600;
}

/* ── ADMIN CLIENTES ── */
.admin-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 22px;
  align-items: start;
}

/* ── RESPONSIVE PANEL ── */
@media (max-width: 960px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .form-row-2 { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .page-header { flex-direction: column; }

  .client-profile-modal__dialog {
    width: min(560px, calc(100vw - 20px));
    margin: 16px auto;
    padding: 20px;
    border-radius: 20px;
  }

  .client-profile-form__row {
    grid-template-columns: 1fr;
  }

  .auth-right {
    padding: 28px 18px;
  }

  .auth-box {
    max-width: 100%;
  }

  .auth-links {
    flex-direction: column;
    align-items: flex-start;
  }
}
