/* ==============================
   /public/css/app.css
   ==============================
   VelvetWash · Estilos generales
   Paleta VelvetCode Studio
   ============================== */

:root {
  /* ----- Paleta VelvetCode Studio ----- */
  --vc-navy:        #0b1320;   /* fondo del logotipo */
  --vc-navy-2:      #141a33;
  --vc-deep:        #332876;   /* morado profundo */
  --vc-purple:      #5b44b8;   /* morado principal */
  --vc-purple-dark: #48359a;
  --vc-purple-rgb:  91, 68, 184;
  --vc-purple-soft: #eeeafb;
  --vc-turquoise:   #40e8d8;   /* turquesa */
  --vc-turquoise-rgb: 64, 232, 216;
  --vc-turquoise-dark: #13a99b;
  --vc-red:         #f01f24;   /* rojo de acento */

  /* ----- Superficies ----- */
  --bg: #f4f4fa;
  --surface: #ffffff;
  --border: #e4e3ef;
  --text: #1d1b2e;
  --text-muted: #6b6a80;
  --sidebar-width: 268px;

  /* ----- Bootstrap con la paleta ----- */
  --bs-primary: var(--vc-purple);
  --bs-primary-rgb: var(--vc-purple-rgb);
  --bs-primary-text-emphasis: var(--vc-deep);
  --bs-primary-bg-subtle: var(--vc-purple-soft);
  --bs-primary-border-subtle: #cfc6f1;
  --bs-danger: var(--vc-red);
  --bs-danger-rgb: 240, 31, 36;
  --bs-link-color: var(--vc-purple);
  --bs-link-color-rgb: var(--vc-purple-rgb);
  --bs-link-hover-color: var(--vc-deep);
  --bs-body-color: var(--text);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); font-size: .95rem; }
img { max-width: 100%; height: auto; }

/* ==============================
   Botones y formularios
   ============================== */
.btn-primary {
  --bs-btn-bg: var(--vc-purple);
  --bs-btn-border-color: var(--vc-purple);
  --bs-btn-hover-bg: var(--vc-purple-dark);
  --bs-btn-hover-border-color: var(--vc-purple-dark);
  --bs-btn-active-bg: var(--vc-deep);
  --bs-btn-active-border-color: var(--vc-deep);
  --bs-btn-disabled-bg: var(--vc-purple);
  --bs-btn-disabled-border-color: var(--vc-purple);
  --bs-btn-focus-shadow-rgb: var(--vc-purple-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--vc-purple);
  --bs-btn-border-color: var(--vc-purple);
  --bs-btn-hover-bg: var(--vc-purple);
  --bs-btn-hover-border-color: var(--vc-purple);
  --bs-btn-active-bg: var(--vc-purple);
  --bs-btn-active-border-color: var(--vc-purple);
  --bs-btn-focus-shadow-rgb: var(--vc-purple-rgb);
}
.btn-check:checked + .btn-outline-primary { color: #fff; }
.btn-danger, .btn-outline-danger {
  --bs-btn-color: var(--vc-red);
  --bs-btn-border-color: var(--vc-red);
  --bs-btn-hover-bg: var(--vc-red);
  --bs-btn-hover-border-color: var(--vc-red);
  --bs-btn-active-bg: #c4161a;
}

.form-check-input:checked { background-color: var(--vc-purple); border-color: var(--vc-purple); }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--vc-purple);
  box-shadow: 0 0 0 .2rem rgba(var(--vc-purple-rgb), .18);
}
.input-group-text { background: #fafafe; }
.page-link { color: var(--vc-purple); }
.active > .page-link, .page-link.active { background-color: var(--vc-purple); border-color: var(--vc-purple); }
.nav-pills .nav-link { color: var(--vc-purple); }
.nav-pills .nav-link.active { background-color: var(--vc-purple); }
.progress-bar.bg-primary { background-color: var(--vc-purple) !important; }

/* Tamaños cómodos para tacto (tablet y celular) */
.form-control, .form-select { min-height: 44px; }
.btn { min-height: 40px; }
.btn-sm { min-height: 34px; }

/* ==============================
   Layout general
   ============================== */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 1rem; }
.content-inner { max-width: 1600px; margin: 0 auto; }   /* evita que se estire de más en monitores grandes */
@media (min-width: 576px)  { .content { padding: 1.25rem; } }
@media (min-width: 992px)  { .content { padding: 1.75rem; } }
@media (min-width: 1920px) { body { font-size: 1rem; } .content { padding: 2.25rem; } }
.min-w-0 { min-width: 0; }

/* ==============================
   Menú lateral (colores VelvetCode)
   ============================== */
.sidebar-wrap { flex-shrink: 0; }
.sidebar {
  --bs-offcanvas-bg: var(--vc-navy);
  --bs-offcanvas-width: min(300px, 86vw);
  color: #d9dbef;
  background: linear-gradient(180deg, var(--vc-navy) 0%, var(--vc-navy-2) 60%, #1d1747 100%);
}
@media (min-width: 992px) {
  .sidebar-wrap {
    width: var(--sidebar-width);
    position: sticky; top: 0; height: 100vh; height: 100dvh;
    background: linear-gradient(180deg, var(--vc-navy) 0%, var(--vc-navy-2) 60%, #1d1747 100%);
    border-right: 1px solid rgba(var(--vc-turquoise-rgb), .12);
  }
  .sidebar { height: 100%; display: flex; flex-direction: column; }
  .sidebar .offcanvas-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
}
/* Pantallas de escritorio con poca altura (laptops de 768px): menú más compacto */
@media (min-width: 992px) and (max-height: 860px) {
  .sidebar-wrap .sidebar-brand { padding: .75rem 1.1rem; }
  .sidebar-wrap .nav-section { padding: .65rem 1.25rem .25rem; }
  .sidebar-wrap .sidebar .nav-link { padding: .4rem 1rem; }
  .sidebar-wrap .sidebar-footer { padding: .6rem .85rem .7rem; }
  .sidebar-wrap .app-version { margin-top: .35rem; }
}
.sidebar .offcanvas-header { display: flex !important; }   /* visible también en escritorio */
.sidebar .offcanvas-body { flex-direction: column; }

.sidebar-brand {
  display: flex; align-items: center; gap: .75rem; width: 100%;
  padding: 1.1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--vc-purple), var(--vc-turquoise-dark));
  color: #fff; display: grid; place-items: center; font-size: 1.3rem; overflow: hidden;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-logo--lg { width: 64px; height: 64px; font-size: 2rem; border-radius: 16px; }
.brand-name { font-weight: 700; color: #fff; line-height: 1.15; }
.brand-sub  { font-size: .75rem; color: #9da1c4; }

.nav-section {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
  color: var(--vc-turquoise); opacity: .75; padding: 1.1rem 1.25rem .4rem;
}
.sidebar .nav-link {
  display: flex; align-items: center; gap: .7rem;
  color: #cfd2ea; font-weight: 500;
  padding: .62rem 1rem; margin: 1px .6rem; border-radius: 10px;
  border-left: 3px solid transparent;
  transition: background-color .15s, color .15s;
}
.sidebar .nav-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active {
  background: rgba(var(--vc-turquoise-rgb), .12);
  color: var(--vc-turquoise);
  border-left-color: var(--vc-turquoise);
}
.sidebar .nav-link:focus-visible { outline: 2px solid var(--vc-turquoise); outline-offset: 1px; }

.sidebar-footer {
  margin-top: auto; padding: 1rem .85rem 1.1rem;
  border-top: 1px solid rgba(255,255,255,.08); width: 100%;
}
.app-version { font-size: .7rem; color: #7f84ab; text-align: center; margin-top: .6rem; }

/* ==============================
   Créditos "Desarrollado por VelvetCode Studio"
   ============================== */
.vc-credit {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .7rem; border-radius: 12px;
  text-decoration: none; color: #fff;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(var(--vc-turquoise-rgb), .22);
  transition: border-color .15s, background-color .15s, transform .15s;
}
.vc-credit:hover, .vc-credit:focus-visible {
  border-color: var(--vc-turquoise);
  background: rgba(var(--vc-turquoise-rgb), .08);
  color: #fff;
}
.vc-credit-logo {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(var(--vc-turquoise-rgb), .35), 0 0 12px rgba(var(--vc-turquoise-rgb), .18);
}
.vc-credit-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.vc-credit-label { font-size: .68rem; color: #9da1c4; }
.vc-credit-name {
  font-family: "Oswald", "Inter", sans-serif; font-weight: 600; letter-spacing: .03em;
  font-size: .95rem; color: #fff; white-space: nowrap;
}
.vc-credit-ext { margin-left: auto; font-size: .8rem; color: var(--vc-turquoise); opacity: .7; }
.vc-credit--center { justify-content: center; }
.vc-credit--center .vc-credit-ext { margin-left: .25rem; }

/* ==============================
   Barra superior
   ============================== */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: .6rem 1rem; display: flex; align-items: center; gap: .6rem;
  position: sticky; top: 0; z-index: 1020;
}
@media (min-width: 992px) { .topbar { padding: .65rem 1.75rem; } }
.topbar h1 { font-size: 1.1rem; margin: 0; font-weight: 600; min-width: 0; }
@media (min-width: 576px) { .topbar h1 { font-size: 1.2rem; } }
.btn-topbar { background: #f4f3fb; border: 1px solid transparent; }
.btn-topbar:hover { background: var(--vc-purple-soft); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--vc-purple-soft); color: var(--vc-purple);
  display: grid; place-items: center; font-weight: 700; font-size: .8rem;
}
.user-rol { font-size: .72rem; }

/* ==============================
   Tarjetas
   ============================== */
.card { border: 1px solid var(--border); border-radius: 14px; }
.card-header {
  background: transparent; border-bottom: 1px solid var(--border);
  font-weight: 600; padding: .9rem 1.1rem;
}
.card-footer { border-top: 1px solid var(--border); }

.kpi { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.kpi > div:last-child { min-width: 0; }
.kpi-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 1.3rem;
}
.kpi-label { font-size: .8rem; color: var(--text-muted); }
.kpi-value { font-size: clamp(1.1rem, 1rem + .6vw, 1.5rem); font-weight: 700; line-height: 1.2; white-space: nowrap; }
@media (max-width: 575.98px) {
  .kpi { gap: .6rem; }
  .kpi-icon { width: 38px; height: 38px; font-size: 1.1rem; border-radius: 10px; }
  .kpi-value { font-size: 1.05rem; }
}
.bg-primary-subtle { background-color: var(--vc-purple-soft) !important; }
.text-primary-emphasis { color: var(--vc-deep) !important; }

.quick-action {
  display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; height: 100%;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.quick-action:hover { border-color: var(--vc-purple); box-shadow: 0 6px 18px rgba(var(--vc-purple-rgb), .14); color: inherit; }
.quick-action i { font-size: 1.6rem; color: var(--vc-purple); }

/* ==============================
   Tablas
   ============================== */
.table > :not(caption) > * > * { padding: .75rem .9rem; vertical-align: middle; }
.table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 600; background: #fafafe; white-space: nowrap;
}
.table-actions { white-space: nowrap; }
.table-responsive { -webkit-overflow-scrolling: touch; }

/* ==============================
   Nuevo servicio
   ============================== */
.type-option {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .35rem; padding: 1rem .35rem; height: 100%; border-width: 2px;
}
.type-option i { font-size: 1.8rem; }
@media (max-width: 400px) { .type-option { font-size: .85rem; } .type-option i { font-size: 1.5rem; } }
@media (min-width: 1200px) { .summary-sticky { position: sticky; top: 84px; } }
.total-amount { font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); font-weight: 700; color: var(--vc-deep); }

/* ==============================
   Login
   ============================== */
.body-sin-nav { background: var(--vc-navy); }
.login-page {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 1.25rem;
  background:
    radial-gradient(circle at 15% 20%, rgba(var(--vc-turquoise-rgb), .16), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(var(--vc-purple-rgb), .35), transparent 45%),
    linear-gradient(160deg, var(--vc-navy) 0%, #161a3a 55%, var(--vc-deep) 100%);
}
.login-card { width: 100%; max-width: 420px; }
.login-card .card { border-radius: 18px; }
.login-credit { margin-top: 1.25rem; display: flex; justify-content: center; }
.login-credit .vc-credit { background: rgba(255,255,255,.05); }

/* ==============================
   Utilidades
   ============================== */
.text-income  { color: #198754; }
.text-expense { color: var(--vc-red); }
.bar-label { display: flex; justify-content: space-between; gap: .5rem; font-size: .85rem; margin-bottom: .3rem; flex-wrap: wrap; }
.modal-content { border-radius: 16px; }
