/* ── RestoSoft Portal de Clientes ─────────────────────── */

:root {
  --primary:      #1487da;
  --primary-dark: #0b3996;
  --success:      #10b981;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --sidebar-bg:   #0f1523;
  --txt-dark:     #0d1b2a;
  --txt-body:     #374151;
  --txt-muted:    #6b7280;
  --txt-light:    #9ca3af;
  --bg:           #f0f4f8;
  --border:       #d1d5db;
  --border-soft:  #e5e7eb;
  --white:        #ffffff;
  --r:            10px;
  --r-lg:         16px;
  --t:            .18s ease;
  --sh:           0 2px 12px rgba(0,0,0,.07);
  --sh-lg:        0 8px 32px rgba(0,0,0,.12);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; overflow-x:hidden; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--txt-body);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { opacity: .8; }

/* ── LOGIN ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #0b3996 0%, #1487da 100%);
}
.login-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--sh-lg);
  text-align: center;
}
.login-logo {
  height: 52px;
  margin-bottom: 1.5rem;
}
.login-card h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--txt-dark);
  margin-bottom: .35rem;
}
.login-card p {
  font-size: .88rem;
  color: var(--txt-muted);
  margin-bottom: 1.75rem;
}
.field { margin-bottom: 1rem; text-align: left; }
.field label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--txt-dark);
  margin-bottom: .4rem;
}
.field input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: .65rem .9rem;
  font-size: .9rem;
  font-family: inherit;
  color: var(--txt-dark);
  background: var(--white);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20,135,218,.12);
}
.btn-login {
  width: 100%;
  padding: .75rem;
  background: var(--primary);
  border: none;
  border-radius: var(--r);
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: .5rem;
  transition: background var(--t);
}
.btn-login:hover { background: var(--primary-dark); }
.login-footer {
  margin-top: 1.5rem;
  font-size: .78rem;
  color: var(--txt-light);
}

/* ── LAYOUT AUTENTICADO ────────────────────────────────── */
.portal-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
}

/* Sidebar */
.portal-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 1.5rem 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand img { height: 34px; display: block; }
.sidebar-resto {
  font-size: .75rem;
  color: rgba(255,255,255,.45);
  margin-top: .5rem;
  font-weight: 500;
  line-height: 1.4;
}
.sidebar-nav {
  flex: 1;
  padding: .75rem 0;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem 1.5rem;
  color: rgba(255,255,255,.6);
  font-size: .87rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--t);
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(20,135,218,.15);
  color: #fff;
  border-left-color: var(--primary);
  opacity: 1;
}
.sidebar-nav a i { width: 18px; text-align: center; font-size: .9rem; }
.sidebar-nav hr { border: none; border-top: 1px solid rgba(255,255,255,.08); margin: .5rem 1.25rem; }
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer a {
  color: rgba(255,255,255,.4);
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar-footer a:hover { color: #fff; opacity: 1; }

/* Main content */
.portal-main {
  margin-left: 230px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.portal-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border-soft);
  padding: .9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.portal-topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--txt-dark);
}
.portal-topbar-user {
  font-size: .83rem;
  color: var(--txt-muted);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.portal-content {
  padding: 2rem;
  flex: 1;
}
.portal-footer {
  padding: 1rem 2rem;
  text-align: center;
  font-size: .78rem;
  color: var(--txt-light);
  border-top: 1px solid var(--border-soft);
  background: var(--white);
}

/* ── STAT CARDS (resumen) ───────────────────────────────── */
.p-stat-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
}
.p-stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.p-stat-info {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.p-stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--txt-dark);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-stat-lbl {
  font-size: .8rem;
  color: var(--txt-muted);
  margin-top: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 480px) {
  .p-stat-wrap { padding: 1rem; gap: .75rem; }
  .p-stat-num  { font-size: 1.35rem; }
}

/* ── CARDS ─────────────────────────────────────────────── */
.p-card {
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  overflow: hidden;
  margin-bottom: 1.5rem;
  min-width: 0;
  max-width: 100%;
}
.p-card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
.p-card-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--txt-dark);
  margin: 0;
}
.p-card-header .icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}
.icon-blue   { background: rgba(20,135,218,.12); color: var(--primary); }
.icon-green  { background: rgba(16,185,129,.12); color: var(--success); }
.icon-yellow { background: rgba(245,158,11,.12);  color: var(--warning); }
.icon-red    { background: rgba(239,68,68,.12);   color: var(--danger); }
.p-card-body { padding: 1.5rem; }

/* ── GRID ──────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
/* Todos los hijos directos de grids pueden encoger por debajo de su contenido */
.grid-2 > *, .grid-3 > *, .form-grid > * { min-width: 0; }

/* ── BADGES / STATUS ───────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .75rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 700;
}
.badge-success { background: rgba(16,185,129,.12); color: var(--success); }
.badge-danger  { background: rgba(239,68,68,.12);  color: var(--danger); }
.badge-primary { background: rgba(20,135,218,.12); color: var(--primary); }

/* ── CLAVE DISPLAY ─────────────────────────────────────── */
.clave-wrap {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: var(--r-lg);
  padding: 1.75rem;
  color: #fff;
  margin-bottom: 1.5rem;
}
.clave-mes-label {
  font-size: .78rem;
  font-weight: 600;
  opacity: .7;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .5rem;
}
.clave-value {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: .12em;
  margin-bottom: 1rem;
}
.clave-copy-btn {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: .4rem 1rem;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--t);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.clave-copy-btn:hover { background: rgba(255,255,255,.28); }

/* ── INFO ROWS ─────────────────────────────────────────── */
.info-list { list-style: none; }
.info-list li {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: .9rem;
}
.info-list li:last-child { border-bottom: none; }
.info-list li i { color: var(--primary); width: 18px; text-align: center; }
.info-list .lbl { color: var(--txt-muted); min-width: 130px; font-size: .82rem; font-weight: 600; }
.info-list .val { color: var(--txt-dark); font-weight: 500; }

/* ── NOVEDADES ─────────────────────────────────────────── */
.novedad-list { list-style: none; }
.novedad-list li {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: .88rem;
  color: var(--txt-body);
}
.novedad-list li:last-child { border-bottom: none; }
.novedad-list li i { color: var(--primary); margin-top: 2px; flex-shrink: 0; }
.novedad-list a { color: var(--primary); font-weight: 600; }

/* ── ALERT BOX ─────────────────────────────────────────── */
.alert {
  padding: .9rem 1.1rem;
  border-radius: var(--r);
  margin-bottom: 1.25rem;
  font-size: .88rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 500;
}
.alert-danger  { background: rgba(239,68,68,.1);  color: #b91c1c; }
.alert-success { background: rgba(16,185,129,.1); color: #065f46; }
.alert-warning { background: rgba(245,158,11,.1); color: #92400e; }

/* ── FORMS ─────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--txt-dark); }
.form-group input,
.form-group select,
.form-group textarea {
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: .6rem .85rem;
  font-size: .9rem;
  font-family: inherit;
  color: var(--txt-dark);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20,135,218,.1);
}

/* ── BUTTONS ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem 1.4rem;
  border-radius: var(--r);
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--t);
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); opacity:1; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; opacity: 1; }
.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-wa { background: #25D366; color: #fff; border-color: #25D366; }
.btn-wa:hover { background: #1ebe5a; opacity: 1; }

/* ── PAGOS ─────────────────────────────────────────────── */
.banco-card {
  border: 1.5px solid var(--border-soft);
  border-radius: var(--r);
  padding: 1.1rem 1.25rem;
  margin-bottom: .85rem;
  background: #fafcff;
  min-width: 0;
  overflow: hidden;
}
.banco-card h4 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--txt-dark);
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.banco-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .85rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--border-soft);
  gap: .75rem;
}
.banco-row:last-child { border-bottom: none; }
.banco-lbl { color: var(--txt-muted); font-size: .78rem; font-weight: 600; min-width: 90px; flex-shrink: 0; }
.banco-val { color: var(--txt-dark); font-weight: 600; font-family: monospace; font-size: .88rem; flex: 1; min-width: 0; word-break: break-all; }
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .18rem .5rem;
  font-size: .72rem;
  cursor: pointer;
  color: var(--txt-muted);
  transition: all var(--t);
  flex-shrink: 0;
}
.copy-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.qr-wrap { text-align: center; padding: 1rem 0; }
.qr-wrap img { max-width: 180px; border-radius: 10px; box-shadow: var(--sh); }

/* ── ESTADO SUSPENDIDO ──────────────────────────────────── */
.suspended-banner {
  background: linear-gradient(135deg, #7f1d1d, #ef4444);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.suspended-banner i { font-size: 2rem; flex-shrink: 0; }
.suspended-banner h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: .2rem; }
.suspended-banner p  { font-size: .88rem; opacity: .85; margin: 0; }

/* ── MOBILE TOPBAR ─────────────────────────────────────── */
.mobile-topbar {
  display: none;
  background: var(--sidebar-bg);
  padding: .75rem 1rem;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
}
.mobile-topbar img { height: 28px; }
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all var(--t);
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}

/* ── DETALLE DE REMITO ──────────────────────────────────── */
.remito-detalle-wrap { max-width: 760px; }
.remito-detalle-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: .5rem;
}
.remito-doc {
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  padding: 2rem 2.5rem;
}
.remito-doc-header {
  display: flex; align-items: flex-start; gap: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-soft);
  margin-bottom: 1.25rem;
}
.remito-doc-logo img { height: 40px; }
.remito-doc-info { flex: 1; }
.remito-doc-info h2 { font-size: 1.3rem; font-weight: 800; color: var(--txt-dark); margin: 0 0 .2rem; }
.remito-tipo { font-size: .82rem; color: var(--txt-muted); margin: 0; }
.remito-fechas {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem; margin-bottom: .5rem;
}
.remito-fecha-item { display: flex; flex-direction: column; gap: .2rem; }
.remito-fecha-lbl { font-size: .75rem; font-weight: 600; color: var(--txt-muted); text-transform: uppercase; letter-spacing: .05em; }
.remito-fecha-val { font-size: .92rem; font-weight: 600; color: var(--txt-dark); }
.remito-totales {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 2px solid var(--border-soft);
  max-width: 280px;
  margin-left: auto;
}
.remito-total-row {
  display: flex; justify-content: space-between;
  padding: .4rem 0;
  font-size: .92rem;
  border-bottom: 1px solid var(--border-soft);
}
.remito-total-row:last-child { border-bottom: none; }
.remito-total-saldo { font-size: 1.05rem; font-weight: 800; }
.remito-pie {
  margin-top: 2rem;
  text-align: center;
  font-size: .75rem;
  color: var(--txt-light);
}

/* ── ESTILOS DE IMPRESIÓN ───────────────────────────────── */
@media print {
  .portal-sidebar, .mobile-topbar, .portal-topbar,
  .portal-footer, .remito-detalle-toolbar { display: none !important; }
  .portal-main { margin-left: 0 !important; }
  .portal-content { padding: 0 !important; }
  .remito-doc {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 1rem !important;
  }
  .remitos-table tbody tr:hover { background: transparent !important; }
  body { background: #fff !important; }
}

/* ── TABLA REMITOS ──────────────────────────────────────── */
.remitos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.remitos-table thead th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  color: var(--txt-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--border-soft);
  background: #fafcff;
  white-space: nowrap;
}
.remitos-table tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--t);
}
.remitos-table tbody tr:last-child { border-bottom: none; }
.remitos-table tbody tr:hover { background: #f7faff; }
.remitos-table tbody tr.row-vencida { background: rgba(239,68,68,.03); }
.remitos-table tbody tr.row-vencida:hover { background: rgba(239,68,68,.07); }
.remitos-table td { padding: .8rem 1rem; color: var(--txt-body); vertical-align: middle; }
.badge-warning  { background: rgba(245,158,11,.12); color: #92400e; }
.badge-vencido  { background: rgba(239,68,68,.15);  color: #991b1b; }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .portal-sidebar {
    transform: translateX(-100%);
    transition: transform var(--t);
  }
  .portal-sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .portal-main { margin-left: 0; }
  .mobile-topbar { display: flex; }
  .portal-topbar { display: none; }
  .portal-content { padding: 1.25rem 1rem; min-width: 0; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr !important; }
  /* Hijos de grids en mobile también pueden encoger */
  .grid-2 > *, .grid-3 > * { min-width: 0; }
  .clave-value { font-size: 2rem; }
  /* Header del card: wrap para que el texto no desborde */
  .p-card-header { flex-wrap: wrap; row-gap: .4rem; }

  /* Remito detalle */
  .remito-detalle-wrap { max-width: 100%; }
  .remito-doc { padding: 1.25rem 1rem; }
  .remito-doc-header { flex-direction: column; gap: .75rem; }
  .remito-fechas { grid-template-columns: 1fr 1fr; }

  /* Pagos */
  .banco-row { flex-wrap: wrap; gap: .35rem; }
  .banco-lbl { min-width: unset; }
  .info-list .lbl { min-width: 90px; }
}

@media (max-width: 480px) {
  .portal-content { padding: 1rem .75rem; }
  .p-card-body { padding: 1rem; }
  .p-card-header { padding: .9rem 1rem; }
  .clave-wrap { padding: 1.25rem; }
  .clave-value { font-size: 1.75rem; }
  .remito-fechas { grid-template-columns: 1fr; }
  .remito-totales { max-width: 100%; }

  /* Pagos: apilar etiqueta + valor en filas muy chicas */
  .banco-row { flex-wrap: wrap; gap: .15rem .5rem; padding: .5rem 0; }
  .banco-lbl { min-width: 100%; margin-bottom: .05rem; }
  .banco-val { font-size: .82rem; }
  .copy-btn  { margin-left: auto; }

  /* Banco card padding más compacto */
  .banco-card { padding: .85rem 1rem; }

  /* QR más grande en mobile */
  .qr-wrap img { max-width: 220px; }
}
