/* Panel de Clientes CTMD — línea estética "GotPOS modern"
   Primario naranja #ff762d, azul #003568, IBM Plex Sans, sidebar oscuro, radio 6px. */

:root {
  --primary: #ff762d;
  --primary-hover: #e66a29;
  --primary-soft: rgba(255, 118, 45, .12);
  --blue: #003568;
  --body-bg: #f7f7f7;
  --card-bg: #ffffff;
  --text: #18181a;
  --muted: #6b6b73;
  --border: #e9e9e9;
  --sidebar-bg: #16181d;
  --sidebar-muted: #9a9ca5;
  --radius: 6px;
  --radius-lg: .75rem;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ---------- Auth simple (recuperación / reseteo) ---------- */
.auth-simple { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: var(--body-bg); }
.auth-simple .box { width: 100%; max-width: 410px; }
.auth-simple .brand-mobile { display: flex; justify-content: center; margin-bottom: 1.75rem; }
.auth-simple h2 { font-size: 1.4rem; font-weight: 600; margin: 0 0 .35rem; }
.auth-simple .sub { color: var(--muted); margin: 0 0 1.75rem; font-size: .92rem; }
.auth-simple .card { box-shadow: var(--shadow-lg); }
.auth-simple .back { display: inline-flex; align-items: center; gap: .35rem; margin-top: 1.1rem; font-size: .88rem; color: var(--muted); }
.auth-simple .back:hover { color: var(--primary); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-aside {
  background: linear-gradient(150deg, var(--blue) 0%, #001f3f 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
  padding: 3.5rem 4rem;
  position: relative;
  overflow: hidden;
}
.login-aside .aside-main { margin: auto 0; }
.login-aside::after {
  content: "";
  position: absolute;
  width: 380px; height: 380px;
  right: -120px; bottom: -120px;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  opacity: .35;
}
/* Marca: chip blanco con el logo a todo color (lockup logo + wordmark) */
.brand-lockup { display: inline-flex; align-items: center; gap: .8rem; }
.brand-chip {
  width: 52px; height: 52px; flex: 0 0 auto;
  background: #fff; border-radius: 14px;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
}
.brand-chip img { width: 70%; height: 70%; object-fit: contain; display: block; }
.brand-chip.sm { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.brand-word { font-weight: 700; font-size: 1.2rem; letter-spacing: .02em; line-height: 1; }
.brand-word small { display: block; font-weight: 400; font-size: .72rem; opacity: .7; margin-top: 2px; letter-spacing: .04em; }

.login-aside .brand-lockup { color: #fff; margin-bottom: 2.5rem; }
.login-aside h1 { font-size: 2rem; font-weight: 600; margin: 0 0 .75rem; line-height: 1.2; }
.login-aside p { color: rgba(255, 255, 255, .7); max-width: 380px; font-size: .95rem; }

/* Tira de logos de las agencias del grupo */
.agencies { position: relative; z-index: 1; }
.agencies .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: rgba(255, 255, 255, .55); margin-bottom: .9rem; }
.agencies .row { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.agencies .chip {
  background: #fff; border-radius: 8px;
  height: 40px; padding: 0 13px;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .14);
}
.agencies .chip img { height: 20px; width: auto; max-width: 118px; object-fit: contain; display: block; }

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-card { width: 100%; max-width: 380px; }
.login-card .brand-mobile { display: none; color: var(--text); }
.login-card h2 { font-size: 1.5rem; font-weight: 600; margin: 0 0 .35rem; }
.login-card .sub { color: var(--muted); margin: 0 0 2rem; }

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 500; margin-bottom: .4rem; font-size: .875rem; }
.field input {
  width: 100%;
  padding: .7rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit; font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: #f0f0f1; }

.alert {
  padding: .7rem .85rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1.25rem;
}
.alert-danger { background: #fdecec; color: #b42318; border: 1px solid #f6cfca; }

/* ---------- Layout app ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-muted);
  padding: 1.25rem 0;
  display: flex; flex-direction: column;
}
.sidebar .logo-row { padding: .25rem 1.25rem 1.5rem; }
.sidebar .logo-row .brand-word { color: #fff; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 .75rem; }
.sidebar nav a {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .9rem;
  border-radius: var(--radius);
  color: var(--sidebar-muted);
  font-weight: 500;
}
.sidebar nav a i { font-size: 1.15rem; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .nav-section { padding: 1.25rem 1.5rem .4rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #5b5e68; }

.main { display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky; top: 0; z-index: 10;
}
.topbar .page-title { font-weight: 600; font-size: 1.05rem; }
.topbar .user-chip { display: flex; align-items: center; gap: .65rem; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 600;
  overflow: hidden; flex: 0 0 auto; text-decoration: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 84px; height: 84px; font-size: 2rem; }
.user-chip .meta { line-height: 1.15; }
.user-chip .meta .n { font-weight: 600; font-size: .85rem; }
.user-chip .meta .r { font-size: .75rem; color: var(--muted); }

.content { padding: 1.75rem; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.card + .card { margin-top: 1.25rem; }

.hero-card {
  background: linear-gradient(120deg, #fff 60%, var(--primary-soft) 100%);
  display: flex; align-items: center; gap: 1.25rem;
}
.hero-card .icon {
  width: 56px; height: 56px; border-radius: 14px; flex: 0 0 auto;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 1.6rem;
}
.hero-card h3 { margin: 0 0 .25rem; font-size: 1.35rem; }
.hero-card p { margin: 0; color: var(--muted); }

/* ---------- Tarjeta de consultor ---------- */
.consultor-card { margin-top: 1.25rem; }
.consultor-card .ct-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  display: flex; align-items: center; gap: .4rem; margin-bottom: 1rem;
}
.consultor-card .ct-label i { color: var(--primary); }
.consultor-card .ct-body { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.consultor-card .ct-info { flex: 1; min-width: 180px; }
.consultor-card .ct-name { font-weight: 600; font-size: 1.15rem; margin-bottom: .35rem; }
.consultor-card .ct-contact { display: flex; flex-direction: column; gap: .3rem; }
.consultor-card .ct-contact a { color: var(--muted); font-size: .88rem; display: inline-flex; align-items: center; gap: .45rem; width: fit-content; }
.consultor-card .ct-contact a:hover { color: var(--primary); }
.consultor-card .ct-contact i { color: var(--primary); }

.btn-wa {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.25rem; border-radius: var(--radius);
  background: #25d366; color: #fff; font-weight: 600; font-size: .92rem;
  white-space: nowrap; transition: background .15s;
}
.btn-wa:hover { background: #1ebe5a; color: #fff; }
.btn-wa i { font-size: 1.2rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-top: 1.25rem; }
.stat { display: flex; align-items: center; gap: 1rem; }
.stat .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; }
.stat .ic.o { background: var(--primary-soft); color: var(--primary); }
.stat .ic.b { background: rgba(0, 53, 104, .1); color: var(--blue); }
.stat .v { font-size: 1.4rem; font-weight: 700; }
.stat .l { font-size: .8rem; color: var(--muted); }

/* ---------- Tabla ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tbl thead th {
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  padding: .85rem 1.25rem; background: #fafafb; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl tbody td { padding: .9rem 1.25rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #fafafb; }
.tbl .muted { color: #b3b3ba; }

.pill { display: inline-block; padding: .25rem .65rem; border-radius: 50rem; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.pill-ok     { background: #e7f6ec; color: #1a7f3c; }
.pill-pend   { background: #fff4e5; color: #b46a00; }
.pill-cancel { background: #fdecec; color: #b42318; }

.btn-pdf {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .7rem; font: inherit; font-size: .8rem; font-weight: 600;
  color: var(--primary); background: var(--primary-soft);
  border: 1px solid transparent; border-radius: var(--radius); cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-pdf:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: .45rem .8rem; font-size: .82rem; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16, 24, 40, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.modal-backdrop[hidden] { display: none; }
.modal-box {
  background: #fff; border-radius: var(--radius-lg);
  width: 100%; max-width: 900px; height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.25rem; border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.modal-title { font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.modal-title i { color: var(--primary); }
.modal-actions { display: flex; align-items: center; gap: .6rem; }
.modal-close {
  width: 34px; height: 34px; border: none; background: #f0f0f1; border-radius: var(--radius);
  cursor: pointer; font-size: 1.1rem; color: var(--muted); display: grid; place-items: center;
}
.modal-close:hover { background: #e6e6e8; color: var(--text); }
.modal-body { flex: 1; background: #525659; }
.modal-body iframe { width: 100%; height: 100%; border: none; display: block; }

@media (max-width: 600px) {
  .modal-backdrop { padding: 0; }
  .modal-box { max-width: none; height: 100vh; border-radius: 0; }
}

.badge { display: inline-block; padding: .2rem .6rem; border-radius: 50rem; font-size: .72rem; font-weight: 600; }
.badge-o { background: var(--primary-soft); color: var(--primary-hover); }
.badge-b { background: rgba(0, 53, 104, .1); color: var(--blue); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .rec-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-card .brand-mobile { display: flex; justify-content: center; margin-bottom: 1.75rem; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
