/* =====================================================
   RARS Ventas v2 — Hoja de estilos completa
   Rojo: #8B0000 | Azul marino: #1B2A4A
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; color: #222; background: #f2f4f8; min-height: 100vh; }

/* ===================== LOGIN ===================== */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1B2A4A 0%, #8B0000 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.logo-brand { font-size: 30px; font-weight: 800; color: #8B0000; line-height: 1; }
.logo-sub { font-size: 10px; color: #1B2A4A; font-weight: 600; letter-spacing: 0.5px; }
.login-card h2 { font-size: 16px; font-weight: 600; color: #1B2A4A; margin-bottom: 20px; }

/* ===================== TOPBAR ===================== */
.topbar { background: #8B0000; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; max-width: 700px; margin: 0 auto; }
.topbar-brand { color: white; font-weight: 700; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user { color: rgba(255,255,255,0.85); font-size: 12px; }
.btn-logout { background: rgba(255,255,255,0.15); color: white; border: none; padding: 5px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; text-decoration: none; }
.btn-logout:hover { background: rgba(255,255,255,0.25); }
.notif-badge { background: #cc2200; color: white; border-radius: 20px; padding: 3px 9px; font-size: 11px; font-weight: 700; text-decoration: none; }

/* ===================== FORM LAYOUT ===================== */
.form-body { background: #f2f4f8; }
.form-main { max-width: 680px; margin: 0 auto; padding: 16px; }
.form-card { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.form-title { font-size: 18px; font-weight: 700; color: #8B0000; margin-bottom: 4px; }
.form-subtitle { font-size: 11px; color: #888; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 20px; }

/* ===================== SECTION LABELS ===================== */
.section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: #1B2A4A; background: #eef2f8; padding: 6px 10px; border-radius: 6px; margin: 18px 0 12px; }

/* ===================== FIELDS ===================== */
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; font-size: 12px; font-weight: 600; color: #444; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid #dde2ea; border-radius: 8px; font-size: 14px; color: #222; background: #fff; transition: border-color 0.2s; -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #8B0000; box-shadow: 0 0 0 3px rgba(139,0,0,0.08); }
input:disabled, select:disabled { background: #f5f5f5; color: #999; cursor: not-allowed; }
textarea { resize: vertical; min-height: 72px; }

/* ===================== RADIO CARDS ===================== */
.radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-group.vertical { flex-direction: column; }
.radio-group.wrap { flex-wrap: wrap; }
.radio-card { cursor: pointer; border: 2px solid #e0e5ef; border-radius: 10px; transition: border-color 0.15s, box-shadow 0.15s; flex: 1; min-width: 120px; }
.radio-card input[type=radio] { display: none; }
.radio-card-inner { padding: 12px 14px; }
.radio-card:hover { border-color: #8B0000; }
.radio-card.selected { border-color: #8B0000; background: #fff5f5; box-shadow: 0 0 0 3px rgba(139,0,0,0.08); }
.radio-icon { display: block; font-size: 22px; margin-bottom: 4px; }
.radio-title { font-size: 13px; font-weight: 700; color: #222; display: block; }
.radio-sub { font-size: 11px; color: #888; display: block; margin-top: 2px; }
.paquete-card { flex: none; width: 100%; }
.paq-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.paquete-items { list-style: none; padding: 0; margin: 6px 0 0; }
.paquete-items li { font-size: 12px; color: #555; padding: 2px 0; }
.precio-tag { font-size: 14px; font-weight: 800; color: #2d7a4f; white-space: nowrap; }
.plazo-card { min-width: 110px; flex: 1; }

/* ===================== PRECIO RESUMEN ===================== */
.precio-resumen { background: #f0f7ff; border: 1.5px solid #1B2A4A; border-radius: 10px; padding: 14px 16px; margin: 12px 0; }
.precio-main { font-size: 16px; font-weight: 600; color: #1B2A4A; }
.precio-sub { font-size: 12px; color: #888; margin-top: 4px; }

/* ===================== FILE UPLOAD ===================== */
.file-upload { border: 2px dashed #dde2ea; border-radius: 10px; padding: 16px; text-align: center; cursor: pointer; position: relative; transition: border-color 0.2s; }
.file-upload:hover { border-color: #8B0000; }
.file-upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.file-upload-ui { pointer-events: none; }
.file-icon { font-size: 26px; display: block; margin-bottom: 4px; }
.pdf-preview { background: #f0f4ff; border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.pdf-info { font-size: 12px; color: #1B2A4A; font-weight: 500; }
.req-badge { background: #8B0000; color: white; font-size: 9px; padding: 2px 6px; border-radius: 10px; font-weight: 600; vertical-align: middle; }
.gps-status { display: block; font-size: 12px; margin-top: 6px; color: #888; }

/* ===================== BOTONES ===================== */
.btn-primary { display: inline-block; background: #8B0000; color: white; border: none; padding: 11px 22px; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background 0.15s, transform 0.1s; }
.btn-primary:hover { background: #a00000; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary.btn-lg { width: 100%; padding: 14px; font-size: 16px; margin-top: 8px; text-align: center; }
.btn-secondary { display: inline-block; background: #fff; color: #1B2A4A; border: 1.5px solid #1B2A4A; padding: 9px 18px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background 0.15s; }
.btn-secondary:hover { background: #eef2f8; }
.btn-mini { display: inline-block; background: #eef2f8; color: #1B2A4A; border: none; padding: 5px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-mini:hover { background: #d8e2f0; }
.btn-mini-edit { display: inline-block; background: #fff3e0; color: #e65100; border: 1px solid #ffb74d; padding: 4px 8px; border-radius: 5px; font-size: 11px; font-weight: 600; cursor: pointer; }
.pdf-btn { display: inline-flex; align-items: center; gap: 6px; background: #1B2A4A; color: white; padding: 9px 16px; border-radius: 8px; text-decoration: none; font-size: 13px; font-weight: 600; }
.pdf-btn:hover { background: #263d5e; }

/* ===================== ALERTS ===================== */
.alert { padding: 12px 14px; border-radius: 9px; font-size: 13px; font-weight: 500; margin-bottom: 16px; line-height: 1.5; }
.alert-success { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.alert-error   { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; }

/* ===================== MINI LIST (vendedor) ===================== */
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 12px 14px; background: #f9f9f9; border-radius: 10px; border: 1px solid #e5e5e5; text-decoration: none; color: inherit; transition: background 0.15s; }
.mini-item:hover { background: #f0f4ff; }
.mini-item-warn { border-color: #ef9a9a; background: #fff5f5; }
.mini-info strong { display: block; font-size: 14px; color: #8B0000; }
.mini-info span { font-size: 12px; color: #555; }
.mini-meta { font-size: 11px; color: #8B0000; display: block; margin-top: 2px; }
.subsanar-alert { display: block; margin-top: 6px; font-size: 11px; color: #c00; background: #fff0f0; padding: 4px 8px; border-radius: 5px; border: 1px solid #ffcccc; }

/* ===================== BADGES ===================== */
.badge-estado { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-estado-lg { display: inline-block; padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 700; }

/* ===================== ADMIN LAYOUT ===================== */
.admin-body { display: flex; min-height: 100vh; background: #f2f4f8; }
.sidebar { width: 220px; min-width: 220px; background: #1B2A4A; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); color: white; font-size: 15px; font-weight: 700; }
.sidebar-nav { display: flex; flex-direction: column; padding: 12px 0; flex: 1; }
.sidebar-nav a { color: rgba(255,255,255,0.7); text-decoration: none; padding: 11px 18px; font-size: 13px; font-weight: 500; border-left: 3px solid transparent; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.07); color: white; }
.sidebar-nav a.active { background: rgba(139,0,0,0.3); color: white; border-left-color: #cc3333; }
.sb-badge { background: #cc2200; color: white; border-radius: 12px; padding: 1px 7px; font-size: 10px; font-weight: 700; margin-left: auto; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); font-size: 11px; line-height: 1.6; }
.admin-main { flex: 1; padding: 24px 28px; overflow-x: auto; min-width: 0; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.admin-header h1 { font-size: 22px; font-weight: 700; color: #1B2A4A; }
.btn-export { display: inline-flex; align-items: center; gap: 6px; background: #1B2A4A; color: white; padding: 9px 18px; border-radius: 8px; text-decoration: none; font-size: 13px; font-weight: 600; }
.btn-notif { display: inline-flex; align-items: center; gap: 6px; background: #8B0000; color: white; padding: 9px 16px; border-radius: 8px; text-decoration: none; font-size: 13px; font-weight: 600; }
.badge-num { background: #cc2200; color: white; border-radius: 20px; padding: 1px 7px; font-size: 11px; }

/* ===================== STATS ===================== */
.stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 22px; }
.stat-card { background: #fff; border-radius: 12px; padding: 14px 16px; border-left: 4px solid #1B2A4A; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.stat-card.stat-warn { border-left-color: #e8a000; }
.stat-card.stat-ok   { border-left-color: #2d7a4f; }
.stat-card.stat-info { border-left-color: #1565c0; }
.stat-num { font-size: 26px; font-weight: 800; color: #1B2A4A; }
.stat-label { font-size: 11px; color: #888; margin-top: 2px; }

/* ===================== FILTROS ===================== */
.filter-bar { margin-bottom: 18px; }
.filter-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filter-form input, .filter-form select { width: auto; min-width: 120px; }

/* ===================== TABLA ADMIN ===================== */
.table-wrap { overflow-x: auto; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.05); }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
.admin-table thead th { background: #1B2A4A; color: rgba(255,255,255,0.85); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding: 11px 12px; text-align: left; white-space: nowrap; }
.admin-table tbody tr { border-bottom: 0.5px solid #eee; }
.admin-table tbody tr:hover { background: #fafafa; }
.admin-table tbody tr.row-warn { background: #fff5f5; }
.admin-table td { padding: 10px 12px; vertical-align: top; }
.link-contrato { color: #8B0000; font-weight: 700; text-decoration: none; }
.link-contrato:hover { text-decoration: underline; }

/* ===================== EXPORT CARDS ===================== */
.export-card { background: #fff; border-radius: 12px; padding: 20px 22px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.export-card h3 { font-size: 15px; font-weight: 700; color: #1B2A4A; margin-bottom: 8px; }
.export-card p { font-size: 13px; color: #555; margin-bottom: 14px; line-height: 1.6; }

/* ===================== NOTIFICACIONES ===================== */
.notif-list { display: flex; flex-direction: column; gap: 0; }
.notif-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-decoration: none; color: inherit; transition: background 0.12s; }
.notif-item:hover { background: #f7f9ff; }
.notif-unread { background: #fff8f8; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: #cc2200; flex-shrink: 0; margin-top: 5px; }
.notif-body { flex: 1; }
.notif-title { font-size: 13px; font-weight: 600; color: #222; margin-bottom: 2px; }
.notif-msg { font-size: 12px; color: #666; margin-bottom: 4px; }
.notif-time { font-size: 11px; color: #aaa; }

/* ===================== DETALLE VENTA ===================== */
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.detail-title { font-size: 22px; font-weight: 800; color: #8B0000; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-card { background: #fff; border-radius: 12px; padding: 16px 18px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.detail-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #1B2A4A; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid #eee; }
.detail-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 5px 0; border-bottom: 0.5px solid #f5f5f5; font-size: 13px; }
.detail-row span:first-child { color: #888; flex-shrink: 0; margin-right: 8px; }
.detail-row strong { text-align: right; color: #222; }

/* ===================== TIMELINE ===================== */
.timeline { display: flex; flex-direction: column; gap: 0; padding-left: 8px; }
.timeline-item { display: flex; gap: 14px; padding: 10px 0; border-bottom: 0.5px solid #f0f0f0; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.timeline-content { flex: 1; }
.timeline-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; flex-wrap: wrap; gap: 6px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .admin-body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; padding: 0; }
  .sidebar-nav a { padding: 12px 14px; white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .sidebar-nav a.active { border-left: none; border-bottom-color: #cc3333; }
  .admin-main { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .login-card { margin: 16px; padding: 24px 20px; }
  .radio-group { flex-direction: column; }
  .radio-card { min-width: 100%; }
  .plazo-card { min-width: calc(50% - 5px); }
}
