/* =========================================================
   TOP RECAMBIOS · Portal Comercial
   ========================================================= */
:root {
    --brand: #f8ac0e;
    --brand-600: #e09700;
    --brand-50: #fff7e6;
    --ink: #111827;
    --ink-2: #374151;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f4f5f8;
    --card: #ffffff;
    --side: #15181d;
    --side-2: #1e2229;
    --side-txt: #a7adb8;
    --ok: #16a34a;
    --warn: #d97706;
    --info: #0284c7;
    --bad: #dc2626;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
    --side-w: 264px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: 14px;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.text-muted { color: var(--muted) !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; }
.content { padding: 24px 32px 32px; flex: 1; }
.foot { padding: 16px 32px; color: var(--muted); font-size: 12px; }

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--side-w);
    background: linear-gradient(180deg, var(--side) 0%, #101317 100%);
    color: var(--side-txt); display: flex; flex-direction: column; z-index: 1040;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px;
    text-decoration: none; color: #fff; border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand img, .logo-chip {
    height: 44px; width: auto; background: #fff; border-radius: 10px; padding: 5px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.logo-chip { height: 56px; padding: 6px 10px; }
.sidebar-brand span { font-size: 12px; line-height: 1.15; letter-spacing: .06em; text-transform: uppercase; color: var(--side-txt); }
.sidebar-brand b { color: var(--brand); font-size: 15px; letter-spacing: .04em; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px; }
.nav-section { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #5f6672; padding: 18px 12px 8px; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0;
    border-radius: 10px; text-decoration: none; color: var(--side-txt); font-weight: 500;
    position: relative; transition: background .15s, color .15s;
}
.nav-item i { font-size: 17px; width: 20px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: rgba(248,172,14,.12); color: #fff; }
.nav-item.active::before {
    content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px;
    border-radius: 0 4px 4px 0; background: var(--brand);
}
.nav-item.active i { color: var(--brand); }
.nav-badge {
    margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700;
    background: var(--brand); color: #1f2329; border-radius: 20px; padding: 2px 8px;
}
.sidebar-foot {
    display: flex; align-items: center; gap: 8px; padding: 14px 14px;
    border-top: 1px solid rgba(255,255,255,.06); background: rgba(0,0,0,.15);
}
.me { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 1; min-width: 0; padding: 6px; border-radius: 10px; }
.me:hover { background: rgba(255,255,255,.05); }
.me-txt { display: flex; flex-direction: column; min-width: 0; }
.me-txt b { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt small { color: var(--side-txt); font-size: 11.5px; }
.sidebar .btn-icon { color: var(--side-txt); }
.sidebar .btn-icon:hover { color: #fff; background: rgba(255,255,255,.08); }

.avatar {
    --c: var(--brand);
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: #fff;
    background: var(--c); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18);
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }

.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent;
    color: var(--ink-2); font-size: 19px; text-decoration: none; transition: background .15s;
}
.btn-icon:hover { background: rgba(0,0,0,.05); }

/* ---------- Topbar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: 16px;
    padding: 18px 32px; background: rgba(244,245,248,.85); backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.topbar-title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn { font-weight: 600; border-radius: 10px; padding: 8px 16px; font-size: 13.5px; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #1f2329; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-600); border-color: var(--brand-600); color: #111; }
.btn-dark { background: #1f2329; border-color: #1f2329; }
.btn-soft { background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.btn-soft:hover { background: #f9fafb; border-color: #d1d5db; color: var(--ink); }
.btn-lg { padding: 12px 22px; font-size: 15px; }

/* ---------- Tarjetas ---------- */
.card-x {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,.03);
}
.card-x > .card-h {
    display: flex; align-items: center; gap: 10px; padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.card-h h3 { margin: 0; font-size: 15px; font-weight: 700; flex: 1; }
.card-h .ico {
    width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-50); color: var(--brand-600); font-size: 16px;
}
.card-b { padding: 20px; }

/* ---------- KPIs ---------- */
.kpi { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; height: 100%; }
.kpi-ico {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center; font-size: 20px;
    background: var(--brand-50); color: var(--brand-600);
}
.kpi-ico.green { background: #ecfdf5; color: var(--ok); }
.kpi-ico.blue  { background: #eff6ff; color: #2563eb; }
.kpi-ico.red   { background: #fef2f2; color: var(--bad); }
.kpi-ico.violet{ background: #f5f3ff; color: #7c3aed; }
.kpi-lbl { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-val { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.trend-up   { color: var(--ok); font-weight: 600; }
.trend-down { color: var(--bad); font-weight: 600; }

.progress-x { height: 8px; background: #f1f2f4; border-radius: 10px; overflow: hidden; }
.progress-x > span { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--brand), #ffcf5c); }

/* ---------- Hero ---------- */
.hero {
    position: relative; overflow: hidden; border-radius: 18px; padding: 28px 30px; color: #fff;
    background: radial-gradient(120% 140% at 100% 0%, #3a2a06 0%, #1f2329 45%, #15181d 100%);
    box-shadow: var(--shadow);
}
.hero::after {
    content: ''; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%;
    background: radial-gradient(circle, rgba(248,172,14,.45), transparent 70%);
}
.hero h2 { font-weight: 800; font-size: 24px; margin: 0 0 6px; letter-spacing: -.02em; }
.hero p { color: #c7cbd3; margin: 0; }
.hero .btn { position: relative; z-index: 1; }

/* ---------- Tablas ---------- */
.table-x { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
.table-x th {
    font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
    padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap;
    position: sticky; top: 0;
}
.table-x td { padding: 13px 16px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.table-x tbody tr { transition: background .12s; }
.table-x tbody tr:hover { background: #fffbf2; }
.table-x tbody tr[data-href] { cursor: pointer; }
.table-x .cliente-nombre { font-weight: 600; color: var(--ink); text-decoration: none; }
.table-x .cliente-nombre:hover { color: var(--brand-600); }
.table-x small { color: var(--muted); }
.table-wrap { overflow-x: auto; }
th a.sort { color: inherit; text-decoration: none; }
th a.sort:hover { color: var(--ink); }

/* ---------- Badges ---------- */
.badge-estado {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 30px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-warning { background: #fff7e6; color: #b45309; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-secondary { background: #f3f4f6; color: #4b5563; }
.chip {
    display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 600;
    background: #f3f4f6; color: var(--ink-2); margin: 1px 2px 1px 0;
}
.chip-brand { background: var(--brand-50); color: #92400e; }

/* Interruptores llamado / primer pedido */
.flag {
    display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff;
    border-radius: 30px; padding: 4px 10px 4px 6px; font-size: 12px; font-weight: 600; color: var(--muted);
    cursor: pointer; transition: all .15s; user-select: none;
}
.flag .dot { width: 18px; height: 18px; border-radius: 50%; background: #e5e7eb; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; }
.flag.on { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }
.flag.on .dot { background: var(--ok); }
.flag[disabled], .flag.readonly { cursor: default; opacity: .9; }

/* ---------- Formularios ---------- */
.form-label { font-weight: 600; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.form-label .req { color: var(--bad); margin-left: 2px; }
.form-control, .form-select {
    border-radius: 10px; border-color: #dfe2e7; padding: 9px 12px; font-size: 14px;
}
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(248,172,14,.15); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--bad); }
.form-text { font-size: 12px; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9ca3af; }
.input-icon > .form-control { padding-left: 36px; }

.step-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.step-nav a {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 30px; background: #fff;
    border: 1px solid var(--line); font-weight: 600; font-size: 12.5px; color: var(--ink-2); text-decoration: none;
}
.step-nav a span { width: 22px; height: 22px; border-radius: 50%; background: #f3f4f6; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.step-nav a.done span { background: var(--ok); color: #fff; }

.check-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.check-pill input { display: none; }
.check-pill label {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 30px;
    border: 1px solid #dfe2e7; background: #fff; cursor: pointer; font-weight: 600; font-size: 12.5px;
    transition: all .15s; color: var(--ink-2);
}
.check-pill label:hover { border-color: var(--brand); }
.check-pill input:checked + label { background: var(--brand); border-color: var(--brand); color: #1f2329; }
.check-pill input:checked + label::before { content: '\F26E'; font-family: 'bootstrap-icons'; }

.canal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.canal-cards input { display: none; }
.canal-cards label {
    display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 12px 14px;
    border: 1.5px solid #dfe2e7; border-radius: 12px; cursor: pointer; background: #fff; transition: all .15s;
    font-weight: 700; font-size: 12.5px;
}
.canal-cards label i { font-size: 20px; color: #9ca3af; }
.canal-cards input:checked + label { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 4px rgba(248,172,14,.12); }
.canal-cards input:checked + label i { color: var(--brand-600); }

.dropzone {
    border: 2px dashed #d6d9de; border-radius: 14px; padding: 26px; text-align: center; background: #fafbfc;
    transition: all .15s; cursor: pointer;
}
.dropzone.drag, .dropzone:hover { border-color: var(--brand); background: var(--brand-50); }
.dropzone i { font-size: 30px; color: var(--brand-600); }
.file-list { list-style: none; padding: 0; margin: 12px 0 0; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; background: #fff; }
.file-list li .bi { font-size: 18px; color: var(--muted); }

.sticky-submit {
    position: sticky; bottom: 0; z-index: 10; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
    border-top: 1px solid var(--line); padding: 14px 20px; display: flex; gap: 10px; align-items: center;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ---------- Ficha cliente ---------- */
.ficha-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.ficha-logo {
    width: 64px; height: 64px; border-radius: 16px; background: linear-gradient(135deg, var(--brand), #ffcf5c);
    display: inline-flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; color: #1f2329;
}
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 500; font-size: 13px; }
.dl dd { margin: 0; font-weight: 600; word-break: break-word; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 4px; bottom: 4px; width: 2px; background: #eef0f2; }
.timeline li { position: relative; padding: 0 0 18px 46px; }
.timeline .t-ico {
    position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 2px solid #eef0f2;
    font-size: 14px; color: var(--muted);
}
.timeline .t-ico.creacion { color: var(--brand-600); border-color: #fde68a; }
.timeline .t-ico.estado { color: #2563eb; border-color: #bfdbfe; }
.timeline .t-ico.nota { color: #7c3aed; border-color: #ddd6fe; }
.timeline .t-ico.llamado, .timeline .t-ico.primer_pedido { color: var(--ok); border-color: #bbf7d0; }
.timeline .t-ico.email { color: var(--info); border-color: #bae6fd; }
.timeline .t-meta { font-size: 12px; color: var(--muted); }
.timeline .t-txt { white-space: pre-line; }

/* ---------- Estados vacíos ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state.big { padding: 90px 20px; }
.empty-icon {
    width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px; background: var(--brand-50);
    display: flex; align-items: center; justify-content: center; font-size: 30px; color: var(--brand-600);
}
.empty-state h2 { font-size: 20px; font-weight: 700; color: var(--ink); }

/* ---------- Ranking ---------- */
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f0f1f3; }
.rank-row:last-child { border-bottom: 0; }
.rank-pos { width: 28px; height: 28px; border-radius: 8px; background: #f3f4f6; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.rank-pos.p1 { background: #fde68a; color: #92400e; }
.rank-pos.p2 { background: #e5e7eb; color: #374151; }
.rank-pos.p3 { background: #fed7aa; color: #9a3412; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login-art {
    position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
    background: radial-gradient(120% 120% at 0% 100%, #4a3407 0%, #1f2329 45%, #0f1114 100%);
}
.login-art::before {
    content: ''; position: absolute; inset: 0;
    background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 42px 42px; mask-image: radial-gradient(circle at 30% 70%, #000 10%, transparent 70%);
}
.login-art .glow { position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -160px; top: -160px; background: radial-gradient(circle, rgba(248,172,14,.5), transparent 65%); }
.login-art > * { position: relative; }
.login-art h1 { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; max-width: 480px; }
.login-art h1 em { font-style: normal; color: var(--brand); }
.login-art ul { list-style: none; padding: 0; margin: 26px 0 0; color: #c7cbd3; }
.login-art li { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.login-art li i { color: var(--brand); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-box { width: 100%; max-width: 380px; }
.login-box h2 { font-weight: 800; font-size: 26px; letter-spacing: -.02em; }

/* ---------- Checks de llamada de control ---------- */
.ctl {
    display: inline-flex; align-items: center; gap: 9px; padding: 6px 12px 6px 6px; border-radius: 12px;
    border: 1.5px solid var(--line); background: #fff; min-width: 168px; transition: all .15s; user-select: none;
}
.ctl[role="button"] { cursor: pointer; }
.ctl[role="button"]:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.ctl-box {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; border: 2px solid #d1d5db; color: #9ca3af; background: #fff;
}
.ctl-txt { display: flex; flex-direction: column; line-height: 1.2; }
.ctl-txt b { font-size: 12.5px; }
.ctl-txt small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.ctl-ok   { border-color: #bbf7d0; background: #f0fdf4; } .ctl-ok .ctl-box { background: var(--ok); border-color: var(--ok); color: #fff; } .ctl-ok b { color: #15803d; }
.ctl-warn { border-color: #fde68a; background: #fffbeb; } .ctl-warn .ctl-box { background: var(--warn); border-color: var(--warn); color: #fff; } .ctl-warn b { color: #b45309; }
.ctl-hoy  { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(248,172,14,.15); } .ctl-hoy .ctl-box { border-color: var(--brand); color: var(--brand-600); } .ctl-hoy b { color: #92400e; }
.ctl-venc { border-color: #fecaca; background: #fef2f2; } .ctl-venc .ctl-box { border-color: var(--bad); color: var(--bad); } .ctl-venc b { color: #b91c1c; }
.ctl-pend b { color: var(--muted); font-weight: 600; }
.ctl-flash { animation: ctlflash 1s ease; }
@keyframes ctlflash { 0% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(22,163,74,.25); } 100% { transform: none; } }

/* Pasos del estado de un alta */
.stepper { display: flex; align-items: flex-start; gap: 0; margin: 0; padding: 0; list-style: none; }
.stepper li { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--muted); }
.stepper li::before {
    content: ''; position: absolute; top: 15px; left: -50%; right: 50%; height: 3px; background: #e5e7eb; z-index: 0;
}
.stepper li:first-child::before { display: none; }
.stepper .dot {
    position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; margin: 0 auto 6px; background: #fff;
    border: 2px solid #e5e7eb; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #9ca3af;
}
.stepper li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.stepper li.done::before, .stepper li.now::before { background: var(--ok); }
.stepper li.now .dot { border-color: var(--brand); color: var(--brand-600); box-shadow: 0 0 0 4px rgba(248,172,14,.18); }
.stepper li.bad .dot { background: var(--bad); border-color: var(--bad); color: #fff; }
.stepper li b { display: block; color: var(--ink); font-size: 12.5px; }
.mini-steps { display: inline-flex; gap: 3px; margin-top: 5px; }
.mini-steps i { width: 16px; height: 4px; border-radius: 4px; background: #e5e7eb; display: inline-block; }
.mini-steps i.on { background: var(--ok); }
.mini-steps i.bad { background: var(--bad); }

/* Pestañas de estadísticas */
.tabs-x { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs-x a {
    padding: 10px 16px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent;
    white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
}
.tabs-x a:hover { color: var(--ink); }
.tabs-x a.active { color: var(--ink); border-bottom-color: var(--brand); }
.heat td.h { text-align: center; font-weight: 700; font-size: 12.5px; min-width: 44px; }

/* ---------- Agenda ---------- */
.agenda-item { display: flex; align-items: flex-start; gap: 14px; padding: 14px 18px; border-bottom: 1px solid #f0f1f3; }
.agenda-item:last-child { border-bottom: 0; }
.agenda-item.done { opacity: .6; }
.agenda-item.done .fw-semibold { text-decoration: line-through; }
.agenda-time { width: 64px; flex-shrink: 0; display: flex; flex-direction: column; line-height: 1.2; padding-top: 2px; }
.agenda-time b { font-size: 16px; font-weight: 800; }
.agenda-time small { color: var(--muted); font-size: 11.5px; }
.agenda-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
@media (max-width: 575.98px) {
    .agenda-item { flex-wrap: wrap; }
    .agenda-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- Barra inferior móvil ---------- */
.bottom-nav { display: none; }
@media (max-width: 991.98px) {
    .bottom-nav {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
        background: rgba(21,24,29,.97); backdrop-filter: blur(10px);
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        box-shadow: 0 -4px 20px rgba(0,0,0,.15);
    }
    .bottom-nav a {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
        color: #8b919c; text-decoration: none; font-size: 10.5px; font-weight: 600; position: relative;
    }
    .bottom-nav a i { font-size: 21px; }
    .bottom-nav a.active { color: #fff; }
    .bottom-nav a.active i { color: var(--brand); }
    .bottom-nav a.fab i {
        width: 50px; height: 50px; margin-top: -24px; border-radius: 50%; background: var(--brand); color: #1f2329;
        display: flex; align-items: center; justify-content: center; font-size: 26px; box-shadow: 0 6px 18px rgba(248,172,14,.45);
    }
    .bottom-nav em {
        position: absolute; top: 2px; left: 50%; margin-left: 6px; font-style: normal; background: var(--bad); color: #fff;
        font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 6px;
    }
    body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
    .sticky-submit { bottom: calc(66px + env(safe-area-inset-bottom)); }
    .topbar { padding-top: calc(12px + env(safe-area-inset-top)); padding-bottom: 12px; }
    .topbar-title h1 { font-size: 19px; }
    .topbar-actions .btn { padding: 7px 11px; }
    .hero { padding: 22px; }
    .hero h2 { font-size: 20px; }
    .kpi-val { font-size: 22px; }
    .form-control, .form-select { font-size: 16px; } /* evita zoom en iOS */
}

/* Banner de instalación / borrador */
.app-banner {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px;
    background: var(--brand-50); border: 1px solid #fde68a;
}
.app-banner i.big { font-size: 22px; color: var(--brand-600); }

/* ---------- Paginación ---------- */
.pagination .page-link { color: var(--ink-2); border-color: var(--line); }
.pagination .page-item.active .page-link { background: #1f2329; border-color: #1f2329; color: #fff; }
.pagination .page-link:focus { box-shadow: 0 0 0 3px rgba(248,172,14,.25); }

/* ---------- Toasts ---------- */
.toast { border: 0; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.15); }

/* ---------- Responsive ---------- */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1030; }
    .main { margin-left: 0; }
    .content, .topbar, .foot { padding-left: 16px; padding-right: 16px; }
    .login-page { grid-template-columns: 1fr; }
    .login-art { display: none; }
    .dl { grid-template-columns: 1fr; gap: 2px 0; }
    .dl dd { margin-bottom: 10px; }
}

@media print {
    .sidebar, .topbar-actions, .foot, .no-print { display: none !important; }
    .main { margin: 0; }
    .card-x { box-shadow: none; border: 1px solid #ddd; }
}
