/* ─── Wiro · tokens de la identidad visual (tomada del PDF "Wiro - APP") ─── */
:root {
  --wiro-primary: #7357ff;
  --wiro-primary-600: #5f44f0;
  --wiro-primary-700: #4c33d6;
  --wiro-primary-50: #f2efff;
  --wiro-primary-100: #e4ddff;
  --wiro-gradient: linear-gradient(135deg, #9172ff 0%, #6a48f5 100%);
  --wiro-bg: #f6f5fb;
  --wiro-surface: #ffffff;
  --wiro-text: #1d1b2c;
  --wiro-muted: #6e6b80;
  --wiro-border: #ebe9f3;
  --wiro-success: #16a34a;
  --wiro-success-50: #e8f8ee;
  --wiro-warning: #b45309;
  --wiro-warning-50: #fff4e0;
  --wiro-danger: #dc2626;
  --wiro-danger-50: #fdecec;
  --wiro-info-50: #e8f1ff;
  --wiro-info: #1d4ed8;
  --wiro-radius: 16px;
  --wiro-radius-sm: 12px;
  --wiro-shadow: 0 1px 2px rgba(29, 27, 44, .04), 0 6px 20px rgba(29, 27, 44, .06);
  --wiro-shadow-lg: 0 12px 32px rgba(99, 72, 245, .18);
  --wiro-sidebar: 248px;
  --wiro-bottom-nav: 68px;
  --bs-primary: #7357ff;
  --bs-primary-rgb: 115, 87, 255;
  --bs-link-color: #5f44f0;
  --bs-link-hover-color: #4c33d6;
  --bs-link-color-rgb: 95, 68, 240;
  --bs-link-hover-color-rgb: 76, 51, 214;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: #1d1b2c;
  --bs-body-bg: #f6f5fb;
  --bs-border-color: #ebe9f3;
  --bs-focus-ring-color: rgba(115, 87, 255, .25);
}

html, body { min-height: 100%; }
body { background: var(--wiro-bg); color: var(--wiro-text); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
.text-muted, .wiro-muted { color: var(--wiro-muted) !important; }
.fw-semibold { font-weight: 600 !important; }
.min-w-0 { min-width: 0; }
.text-break-any { overflow-wrap: anywhere; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ─── Botones ─── */
.btn { border-radius: var(--wiro-radius-sm); font-weight: 600; padding: .7rem 1.1rem; }
.btn-sm { padding: .4rem .75rem; border-radius: 10px; }
.btn-primary { background: var(--wiro-primary); border-color: var(--wiro-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--wiro-primary-600); border-color: var(--wiro-primary-600); }
.btn-primary:active { background: var(--wiro-primary-700) !important; }
.btn-primary:disabled { background: #b9acff; border-color: #b9acff; }
.btn-outline-primary { color: var(--wiro-primary-600); border-color: var(--wiro-primary-100); background: #fff; }
.btn-outline-primary:hover { background: var(--wiro-primary-50); color: var(--wiro-primary-700); border-color: var(--wiro-primary); }
.btn-soft { background: var(--wiro-primary-50); color: var(--wiro-primary-600); border: 0; }
.btn-soft:hover { background: var(--wiro-primary-100); color: var(--wiro-primary-700); }
.btn-ghost { background: transparent; border: 0; color: var(--wiro-muted); }
.btn-ghost:hover { color: var(--wiro-text); background: rgba(0, 0, 0, .04); }
.btn-google { background: #fff; border: 1px solid var(--wiro-border); color: var(--wiro-text); box-shadow: var(--wiro-shadow); }
.btn-google:hover { border-color: var(--wiro-primary-100); background: #fdfcff; }

/* ─── Formularios ─── */
.form-label { font-weight: 600; font-size: .9rem; margin-bottom: .35rem; }
.form-control, .form-select { border-radius: var(--wiro-radius-sm); border-color: var(--wiro-border); padding: .7rem .9rem; background-color: #fff; }
.form-control:focus, .form-select:focus { border-color: var(--wiro-primary); box-shadow: 0 0 0 .2rem rgba(115, 87, 255, .15); }
.input-icon { position: relative; }
.input-icon > .bi { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--wiro-muted); pointer-events: none; }
.input-icon > .form-control, .input-icon > .form-select { padding-left: 2.5rem; }
.form-text { color: var(--wiro-muted); }
.form-check-input:checked { background-color: var(--wiro-primary); border-color: var(--wiro-primary); }
.option-card { display: flex; gap: .9rem; align-items: flex-start; border: 1.5px solid var(--wiro-border); border-radius: var(--wiro-radius); padding: 1rem; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.option-card:hover { border-color: var(--wiro-primary-100); }
.option-card.active, .option-card:has(input:checked) { border-color: var(--wiro-primary); box-shadow: 0 0 0 3px rgba(115, 87, 255, .12); }
.option-card input { margin-top: .25rem; }

/* ─── Superficies ─── */
.card-wiro { background: var(--wiro-surface); border: 1px solid var(--wiro-border); border-radius: var(--wiro-radius); box-shadow: var(--wiro-shadow); }
.card-wiro .card-body, .card-pad { padding: 1.1rem 1.15rem; }
.card-link { display: block; color: inherit; transition: transform .12s, box-shadow .12s; }
.card-link:hover { color: inherit; transform: translateY(-1px); box-shadow: var(--wiro-shadow-lg); }
.hero { background: var(--wiro-gradient); color: #fff; border-radius: 0 0 28px 28px; padding: 1.5rem 1.25rem 2rem; }
.hero-stat { background: rgba(255, 255, 255, .16); border-radius: var(--wiro-radius); padding: 1rem 1.1rem; backdrop-filter: blur(4px); }
.tip { background: var(--wiro-primary-50); border-radius: var(--wiro-radius-sm); padding: .8rem 1rem; color: var(--wiro-primary-700); font-size: .9rem; }
.alerta-urgente { background: var(--wiro-warning-50); color: var(--wiro-warning); border-radius: var(--wiro-radius-sm); padding: .7rem 1rem; font-weight: 600; }
.escrow { border: 1.5px solid var(--wiro-primary-100); background: var(--wiro-primary-50); border-radius: var(--wiro-radius); padding: 1rem 1.1rem; }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 1.5rem 0 .75rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.page-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.back-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--wiro-border); color: var(--wiro-text); flex: 0 0 auto; }
.back-btn:hover { color: var(--wiro-primary); }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; }
.kv > span:first-child { color: var(--wiro-muted); }
.kv > span:last-child { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; flex-shrink: 0; max-width: 62%; }
.divider { border-top: 1px dashed var(--wiro-border); margin: .6rem 0; }
.empty { text-align: center; color: var(--wiro-muted); padding: 2.5rem 1rem; }
.empty .bi { font-size: 2.2rem; color: var(--wiro-primary-100); display: block; margin-bottom: .5rem; }

/* ─── Chips y avatares ─── */
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; background: var(--wiro-primary-50); color: var(--wiro-primary-600); }
.chip-success { background: var(--wiro-success-50); color: var(--wiro-success); }
.chip-warning { background: var(--wiro-warning-50); color: var(--wiro-warning); }
.chip-danger { background: var(--wiro-danger-50); color: var(--wiro-danger); }
.chip-muted { background: #f1f0f5; color: var(--wiro-muted); }
.chip-info { background: var(--wiro-info-50); color: var(--wiro-info); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--wiro-primary-50); color: var(--wiro-primary-600); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 84px; height: 84px; font-size: 2rem; }
.icon-circle { width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--wiro-primary-50); color: var(--wiro-primary); font-size: 1.25rem; flex: 0 0 auto; }
.stars { color: #f5b301; letter-spacing: 1px; }
.precio { font-weight: 800; color: var(--wiro-primary-600); white-space: nowrap; }
.ruta { font-weight: 700; display: flex; align-items: center; gap: .4rem; min-width: 0; }
.ruta .bi-arrow-right { color: var(--wiro-muted); font-size: .85rem; }

/* ─── Shell de la aplicación ─── */
.app-shell { min-height: 100vh; }
.app-main { padding: 1rem 1rem calc(var(--wiro-bottom-nav) + 1.5rem); max-width: 1040px; margin: 0 auto; }
.app-main.flush { padding-top: 0; }
.topbar { position: sticky; top: 0; z-index: 1020; background: rgba(246, 245, 251, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--wiro-border); }
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: .7rem 1rem; display: flex; align-items: center; gap: .75rem; }
.brand { display: inline-flex; align-items: center; gap: .45rem; font-weight: 800; font-size: 1.25rem; color: var(--wiro-text); }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--wiro-gradient); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
.icon-btn { position: relative; width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--wiro-text); background: #fff; border: 1px solid var(--wiro-border); }
.icon-btn:hover { color: var(--wiro-primary); }
.badge-dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--wiro-danger); color: #fff; font-size: .68rem; font-weight: 700; display: none; align-items: center; justify-content: center; padding: 0 4px; }
.badge-dot.show { display: inline-flex; }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: var(--wiro-bottom-nav); background: #fff; border-top: 1px solid var(--wiro-border); display: flex; z-index: 1030; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--wiro-muted); font-size: .72rem; font-weight: 600; position: relative; }
.bottom-nav a .bi { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--wiro-primary); }
.bottom-nav .badge-dot { top: 6px; right: calc(50% - 22px); }

.sidebar { display: none; }
@media (min-width: 992px) {
  .bottom-nav { display: none; }
  .sidebar { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: var(--wiro-sidebar); background: #fff; border-right: 1px solid var(--wiro-border); padding: 1.25rem .9rem; z-index: 1030; }
  .with-sidebar { margin-left: var(--wiro-sidebar); }
  .with-sidebar .topbar .brand { display: none; }
  .app-main { padding: 1.5rem 2rem 3rem; }
  .hero { border-radius: var(--wiro-radius); margin-top: 1rem; }
}
.sidebar .brand { margin: 0 .5rem 1.5rem; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem; border-radius: 12px; color: var(--wiro-muted); font-weight: 600; margin-bottom: 2px; position: relative; }
.side-link .bi { font-size: 1.15rem; }
.side-link:hover { background: var(--wiro-bg); color: var(--wiro-text); }
.side-link.active { background: var(--wiro-primary-50); color: var(--wiro-primary-600); }
.side-link .badge-dot { position: static; margin-left: auto; }
.side-cta { margin-top: auto; }

/* ─── Pantallas simples (bienvenida, login, onboarding) ─── */
.simple-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.simple-main { flex: 1; width: 100%; max-width: 480px; margin: 0 auto; padding: 1.25rem 1.25rem 2rem; display: flex; flex-direction: column; }
.steps { display: flex; gap: 6px; margin-bottom: 1.5rem; }
.steps span { flex: 1; height: 5px; border-radius: 3px; background: var(--wiro-border); }
.steps span.done { background: var(--wiro-primary); }
.big-emoji { font-size: 3.5rem; line-height: 1; }
.splash { background: var(--wiro-gradient); color: #fff; }
.feature { display: flex; gap: .9rem; align-items: center; padding: .8rem 0; }
.upload-zone { border: 2px dashed var(--wiro-primary-100); border-radius: var(--wiro-radius); background: #fff; padding: 2rem 1rem; text-align: center; cursor: pointer; transition: background .15s, border-color .15s; display: block; }
.upload-zone:hover { background: var(--wiro-primary-50); border-color: var(--wiro-primary); }
.upload-zone .bi { font-size: 2.4rem; color: var(--wiro-primary); }
.upload-zone img { max-width: 100%; max-height: 220px; border-radius: 12px; }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; border: 1px solid var(--wiro-border); }
.pin-input { font-size: 2rem; letter-spacing: .6rem; text-align: center; font-weight: 700; }
.pin-display { font-size: 2.2rem; letter-spacing: .5rem; font-weight: 800; color: var(--wiro-primary-600); font-variant-numeric: tabular-nums; }

/* ─── Línea de tiempo del envío ─── */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: .9rem; position: relative; padding-bottom: 1.1rem; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 34px; bottom: 2px; width: 2px; background: var(--wiro-border); }
.timeline li.done:not(:last-child)::after { background: var(--wiro-primary-100); }
.tl-dot { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; background: #f1f0f5; color: var(--wiro-muted); font-weight: 700; font-size: .85rem; }
.timeline li.done .tl-dot { background: var(--wiro-primary); color: #fff; }
.timeline li.current .tl-dot { background: #fff; border: 3px solid var(--wiro-primary); color: var(--wiro-primary); }

/* ─── Chat ─── */
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 250px); min-height: 380px; }
@media (min-width: 992px) { .chat-wrap { height: calc(100vh - 190px); } }
.chat-list { flex: 1; overflow-y: auto; padding: 1rem .25rem; display: flex; flex-direction: column; gap: .5rem; }
.msg { max-width: 78%; padding: .65rem .9rem; border-radius: 18px; background: #fff; border: 1px solid var(--wiro-border); align-self: flex-start; overflow-wrap: anywhere; }
.msg.mio { align-self: flex-end; background: var(--wiro-primary); color: #fff; border-color: var(--wiro-primary); }
.msg time { display: block; font-size: .7rem; opacity: .7; margin-top: .2rem; text-align: right; }
.msg img { max-width: 220px; border-radius: 12px; display: block; }
.chat-input { display: flex; gap: .5rem; align-items: center; padding: .6rem; background: #fff; border: 1px solid var(--wiro-border); border-radius: 18px; }
.chat-input input[type=text] { border: 0; flex: 1; min-width: 0; outline: none; padding: .4rem; }

/* ─── Calificación ─── */
.star-picker { display: flex; justify-content: center; gap: .4rem; font-size: 2.4rem; }
.star-picker button { background: none; border: 0; color: #e2e0ea; padding: 0; line-height: 1; }
.star-picker button.on { color: #f5b301; }

/* ─── Toasts ─── */
.toast-zone { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 420px); }
.wiro-toast { background: var(--wiro-text); color: #fff; border-radius: 14px; padding: .8rem 1rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); display: flex; gap: .6rem; align-items: flex-start; animation: entra .2s ease-out; }
.wiro-toast.error { background: var(--wiro-danger); }
.wiro-toast.success { background: var(--wiro-success); }
@keyframes entra { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ─── Autocompletar ciudades ─── */
.ac { position: relative; }
.ac-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--wiro-border); border-radius: 12px; box-shadow: var(--wiro-shadow-lg); z-index: 1050; max-height: 260px; overflow-y: auto; display: none; }
.ac-menu.show { display: block; }
.ac-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .6rem .9rem; }
.ac-menu button:hover, .ac-menu button.hl { background: var(--wiro-primary-50); }

/* ─── Tablas (panel) ─── */
.table { --bs-table-bg: transparent; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; color: var(--wiro-muted); border-bottom-width: 1px; white-space: nowrap; }
.table td { vertical-align: middle; }
div.dt-container .dt-paging .dt-paging-button.current { background: var(--wiro-primary-50) !important; border-color: var(--wiro-primary-100) !important; color: var(--wiro-primary-700) !important; border-radius: 8px; }
div.dt-container .dt-input { border-radius: 10px; border: 1px solid var(--wiro-border); padding: .35rem .6rem; }

.skeleton { background: linear-gradient(90deg, #eeedf4 25%, #f7f6fb 50%, #eeedf4 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--wiro-radius); height: 92px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (max-width: 767.98px) {
  .page-head h1 { font-size: 1.2rem; }
  .stack-sm > * { width: 100%; }
}

.hero-bleed { margin: -1rem -1rem 0; }
@media (min-width: 992px) { .hero-bleed { margin: 0; } }
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 768px) { .quick { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.quick a { display: flex; flex-direction: column; gap: .5rem; padding: 1rem; color: var(--wiro-text); font-weight: 600; font-size: .9rem; }
.grid-cards { display: grid; gap: .75rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .grid-cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.page-link { color: var(--wiro-primary-600); }
.active > .page-link, .page-link.active { background-color: var(--wiro-primary); border-color: var(--wiro-primary); }
