/* =========================================================================
   LCM Debugger — hoja de estilos (identidad CASAMANTICA / La Colonia)
   ========================================================================= */

:root {
    --brand-red: #ed1c24;
    --brand-red-dark: #da291c;
    --navy: #0f172a;
    --slate-900: #1e293b;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --bg: #f8fafc;
    --white: #ffffff;
    --green: #16a34a;
    --green-bg: #dcfce7;
    --blue: #2563eb;
    --blue-bg: #eff6ff;
    --amber: #f59e0b;
    --amber-bg: #fff7ed;
    --red-bg: #fee2e2;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-md: 0 6px 18px rgba(15, 23, 42, .08);
    --radius: 16px;
    --radius-lg: 24px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: var(--bg);
    color: var(--slate-900);
    line-height: 1.5;
    overscroll-behavior-y: contain;
    overflow-x: hidden;            /* ninguna vista debe desbordar horizontalmente */
}

a { color: inherit; text-decoration: none; }

/* ---- Top bar ----------------------------------------------------------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--navy);
    color: #fff;
    padding: 16px 32px;
    box-shadow: var(--shadow-md);
}
.topbar .topbar-left { display: flex; align-items: center; gap: 20px; min-width: 0; }
.topbar .brand { display: flex; align-items: center; gap: 12px; font-weight: 900; font-size: 18px; flex: none; }
.topbar .brand .dot { width: 14px; height: 14px; border-radius: 4px; background: var(--brand-red); }
.topbar .brand small { display: block; font-weight: 500; font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--slate-400); }
.topbar .right { display: flex; align-items: center; gap: 18px; }
.topbar .who { font-size: 12px; color: var(--slate-400); text-align: right; }
.topbar .who strong { display: block; color: #fff; font-weight: 700; font-size: 13px; }

/* ---- Selector de proyecto (cabecera) ----------------------------------- */
.project-switcher { min-width: 0; }
.project-switcher .ps-select {
    font-family: inherit; font-size: 13px; font-weight: 700; color: #fff; cursor: pointer;
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px; padding: 8px 12px; max-width: 240px;
}
.project-switcher .ps-select:focus { outline: 2px solid var(--brand-red); border-color: transparent; }
.project-switcher .ps-select option { color: var(--slate-900); }
.project-switcher .ps-static {
    display: inline-flex; flex-direction: column; line-height: 1.2; color: #fff; font-size: 13px; font-weight: 700;
    max-width: 240px; overflow: hidden;
}
.project-switcher .ps-static small { font-weight: 500; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--slate-400); }

/* ---- Enlace de usuario / avatar (cabecera) ----------------------------- */
.topbar .user-link { display: flex; align-items: center; gap: 10px; }
.topbar .avatar {
    width: 38px; height: 38px; border-radius: 999px; flex: none; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.15); color: #fff; font-size: 13px; font-weight: 700;
    border: 1px solid rgba(255,255,255,.2);
}
.topbar .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.topbar .user-link:hover .avatar { border-color: var(--brand-red); }

/* ---- Subtítulo del proyecto activo (dashboard) ------------------------- */
.project-context { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.project-context:empty { margin-top: 0; }
.project-context .pc-name { font-size: 14px; font-weight: 800; color: var(--brand-red-dark); }
.project-context .pc-sub { font-size: 13px; color: var(--slate-500); }

/* ---- Badge de proyecto en las tarjetas (vista "Todos") ----------------- */
.req .proj-badge {
    display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    background: var(--slate-100); color: var(--slate-500); border-radius: 999px; padding: 2px 9px; margin-bottom: 4px;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- Botón de notificaciones ------------------------------------------- */
.bell { position: relative; cursor: pointer; background: rgba(255,255,255,.08); border: none; color: #fff;
        width: 40px; height: 40px; border-radius: 12px; font-size: 18px; }
.bell .badge { position: absolute; top: -6px; right: -6px; background: var(--brand-red); color: #fff;
        font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px;
        display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.bell .badge[hidden] { display: none; }

/* ---- Layout ------------------------------------------------------------ */
.wrap { max-width: 1100px; margin: 0 auto; padding: 32px; }
.page-title { font-size: 26px; font-weight: 900; }
.page-sub { color: var(--slate-500); font-size: 14px; margin-top: 2px; }

/* ---- KPIs -------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin: 24px 0; }
.kpi { background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.kpi .label { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--slate-400); }
.kpi .value { font-size: 32px; font-weight: 900; margin-top: 4px; }
.kpi.accent { border: 2px solid var(--brand-red); }
.kpi[data-status] { cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s; }
.kpi[data-status]:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi.kpi-active { border: 2px solid var(--brand-red); }

/* ---- Botones ----------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
       font-family: inherit; font-weight: 700; font-size: 14px; padding: 11px 18px; border-radius: 12px; transition: .15s; }
.btn-primary { background: var(--brand-red); color: #fff; }
.btn-primary:hover { background: var(--brand-red-dark); }
.btn-ghost { background: var(--slate-100); color: var(--slate-900); }
.btn-ghost:hover { background: var(--slate-200); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---- Tarjetas / lista de solicitudes ----------------------------------- */
.card { background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--slate-200); background: #fff; color: var(--slate-500); padding: 7px 14px; border-radius: 999px;
        font-size: 13px; font-weight: 700; cursor: pointer; }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.req-list { display: flex; flex-direction: column; gap: 12px; }
.req {
    display: flex; gap: 16px; align-items: center; background: #fff;
    border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: .15s;
}
.req:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.req .req-media { position: relative; flex: none; }
.req .thumb { width: 64px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--slate-100); flex: none; display: block; }
.req .thumb.placeholder { display: flex; align-items: center; justify-content: center; color: var(--slate-400); font-size: 20px; }
.req .req-avatar {
    position: absolute; right: -6px; bottom: -6px; width: 28px; height: 28px; border-radius: 999px;
    border: 2px solid #fff; object-fit: cover; background: var(--slate-100); box-shadow: var(--shadow-sm);
}
.req .req-avatar-ini { display: flex; align-items: center; justify-content: center;
    background: var(--brand-red); color: #fff; font-size: 12px; font-weight: 700; }
.req .info { flex: 1; min-width: 0; }
.req .info h3 { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req .info p { font-size: 13px; color: var(--slate-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req .meta { text-align: right; font-size: 11px; color: var(--slate-400); flex: none; }

/* ---- Badges de estado -------------------------------------------------- */
.badge-status { display: inline-block; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.st-borrador    { background: var(--slate-100); color: var(--slate-500); }
.st-pendiente   { background: var(--amber-bg); color: var(--amber); }
.st-en_revision { background: var(--blue-bg);  color: var(--blue); }
.st-ejecutado   { background: #f3e8ff;          color: #7c3aed; }
.st-completado  { background: var(--green-bg); color: var(--green); }
.st-denegado    { background: var(--red-bg);   color: var(--brand-red-dark); }

/* ---- Formularios ------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--slate-500);
               text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.field input[type=text], .field input[type=password], .field input[type=email],
.field input[type=search], .field textarea, .field select {
    width: 100%; font-family: inherit; font-size: 14px; padding: 11px 14px;
    border: 1px solid var(--slate-200); border-radius: 12px; background: #fff; color: var(--slate-900);
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--brand-red); border-color: transparent; }

/* ---- Herramientas de lista: búsqueda + orden + código --------------------- */
.list-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.list-tools .search { flex: 1; min-width: 200px; font-family: inherit; font-size: 14px; padding: 10px 14px;
    border: 1px solid var(--slate-200); border-radius: 12px; background: #fff; color: var(--slate-900); }
.list-tools .search:focus { outline: 2px solid var(--brand-red); border-color: transparent; }
.list-tools .sort-select { font-family: inherit; font-weight: 700; font-size: 13px; padding: 7px 30px 7px 12px;
    border: none; border-radius: 12px; background: var(--slate-100); color: var(--slate-900); cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; }
.list-tools .sort-select:hover { background-color: var(--slate-200); }
.list-tools .sort-select:focus { outline: 2px solid var(--brand-red); }
.list-tools .sort-select option { color: var(--slate-900); }
.req .code { color: var(--slate-400); font-weight: 700; font-size: 12px; letter-spacing: .04em; }

/* zona de captura */
.capture { border: 2px dashed var(--slate-200); border-radius: var(--radius); padding: 20px; text-align: center; color: var(--slate-500); }
.capture.has-image { border-style: solid; padding: 8px; }
.capture img { max-width: 100%; border-radius: 10px; display: block; }
.capture .hint { font-size: 13px; }

/* ---- Modal ------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none; align-items: flex-start;
                  justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 640px; box-shadow: var(--shadow-md); }
.modal header { display: flex; justify-content: space-between; align-items: flex-start; padding: 24px 24px 0; }
.modal header h2 { font-size: 20px; font-weight: 900; }
.modal .body { padding: 20px 24px 24px; }
.modal .close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--slate-400); line-height: 1; }
.modal img.screenshot { width: 100%; border: 1px solid var(--slate-200); border-radius: 12px; margin: 12px 0; }
.prompt-box { background: var(--slate-100); border-radius: 12px; padding: 14px; font-size: 14px; white-space: pre-wrap; }

/* ---- Prompt renderizado como markdown ---------------------------------- */
.prompt-box.md { white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; }
.prompt-box.md > :first-child { margin-top: 0; }
.prompt-box.md > :last-child { margin-bottom: 0; }
.prompt-box.md h1, .prompt-box.md h2, .prompt-box.md h3, .prompt-box.md h4 {
    font-weight: 800; line-height: 1.25; margin: 14px 0 6px; color: var(--slate-900); }
.prompt-box.md h1 { font-size: 20px; }
.prompt-box.md h2 { font-size: 17px; }
.prompt-box.md h3 { font-size: 15px; }
.prompt-box.md h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-500); }
.prompt-box.md p { margin: 8px 0; }
.prompt-box.md ul, .prompt-box.md ol { margin: 8px 0; padding-left: 22px; }
.prompt-box.md li { margin: 3px 0; }
.prompt-box.md code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px;
    background: var(--slate-200); padding: 1px 6px; border-radius: 6px; }
.prompt-box.md pre {
    background: var(--navy); color: #e2e8f0; border-radius: 10px;
    padding: 12px 14px; margin: 10px 0; overflow-x: auto; }
.prompt-box.md pre code { background: none; color: inherit; padding: 0; font-size: 12.5px; }
.prompt-box.md a { color: var(--brand-red-dark); text-decoration: underline; }
.prompt-box.md blockquote {
    margin: 10px 0; padding: 4px 14px; border-left: 3px solid var(--slate-200); color: var(--slate-500); }
.prompt-box.md hr { border: none; border-top: 1px solid var(--slate-200); margin: 14px 0; }
.prompt-box.md table { border-collapse: collapse; margin: 10px 0; font-size: 13px; display: block; overflow-x: auto; max-width: 100%; }
.prompt-box.md th, .prompt-box.md td { border: 1px solid var(--slate-200); padding: 6px 10px; text-align: left; }
.prompt-box.md th { background: var(--slate-200); font-weight: 700; }

/* ---- Reviews / timeline ------------------------------------------------ */
.review { border-left: 3px solid var(--blue); background: var(--blue-bg); padding: 12px 14px; border-radius: 0 10px 10px 0; margin-top: 10px; }
.review .who { font-size: 11px; font-weight: 700; color: var(--blue); }
.review p { font-size: 14px; margin-top: 4px; }
/* respuesta del usuario (depurador) */
.review.reply { border-left-color: var(--brand-red); background: #fff5f5; }
.review.reply .who { color: var(--brand-red-dark); }

/* ---- Panel de acciones del manager ------------------------------------- */
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.actions .btn { width: 100%; justify-content: center; }
.btn-green  { background: var(--green-bg); color: var(--green); }
.btn-red    { background: var(--red-bg);   color: var(--brand-red-dark); }
.btn-blue   { background: var(--blue-bg);  color: var(--blue); }

/* ---- Notificaciones (panel desplegable) -------------------------------- */
.notif-panel { position: fixed; top: 70px; right: 24px; width: 360px; max-height: 70vh; overflow-y: auto;
               background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius); box-shadow: var(--shadow-md);
               display: none; z-index: 60; }
.notif-panel.open { display: block; }
.notif-panel .head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--slate-100); }
.notif-panel .head h3 { font-size: 14px; font-weight: 900; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--slate-100); font-size: 13px; cursor: pointer; }
.notif-item.unread { background: #fff8f8; }
.notif-item .time { font-size: 11px; color: var(--slate-400); margin-top: 4px; }
.notif-empty { padding: 24px; text-align: center; color: var(--slate-400); font-size: 13px; }

/* ---- Pendientes por proyecto (dentro del panel de notificaciones) ------ */
.pending-projects { border-bottom: 1px solid var(--slate-200); background: var(--slate-100); }
.pending-projects[hidden] { display: none; }
.pending-projects .pp-head { padding: 12px 16px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--slate-400); }
.pending-projects .pp-item { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px; cursor: pointer; border-top: 1px solid var(--slate-200); }
.pending-projects .pp-item:hover { background: #fff; }
.pending-projects .pp-name { font-size: 13px; font-weight: 600; color: var(--slate-900);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-projects .pp-count { flex: none; font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; padding: 0 7px;
    border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--slate-200); color: var(--slate-500); }
.pending-projects .pp-count.has { background: var(--amber-bg); color: var(--amber); }

/* ---- Login ------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; background: var(--navy); padding: 24px; }
.login-card { background: #fff; border-radius: var(--radius-lg); padding: 36px; width: 100%; max-width: 380px; box-shadow: var(--shadow-md); }
.login-card .brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 20px; margin-bottom: 4px; }
.login-card .brand .dot { width: 14px; height: 14px; border-radius: 4px; background: var(--brand-red); }
.login-card .sub { color: var(--slate-500); font-size: 13px; margin-bottom: 24px; }
.login-card .hint { font-size: 12px; color: var(--slate-400); margin-top: 16px; text-align: center; line-height: 1.6; }
.alert { background: var(--red-bg); color: var(--brand-red-dark); padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }

/* ---- Bitácora / registro de cambios ------------------------------------ */
.timeline { margin-top: 10px; border-left: 2px solid var(--slate-200); padding-left: 14px; }
.log-item { position: relative; padding: 8px 0; }
.log-item::before { content: ''; position: absolute; left: -21px; top: 13px; width: 9px; height: 9px;
    border-radius: 999px; background: var(--brand-red); border: 2px solid #fff; }
.log-head { font-size: 13px; color: var(--slate-900); }
.log-detail { font-size: 12px; color: var(--slate-500); margin-top: 2px; }
.log-time { font-size: 11px; color: var(--slate-400); margin-top: 2px; }

/* ---- Lista de usuarios ------------------------------------------------- */
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--slate-100); }
.user-row .u-info { flex: 1; min-width: 0; }
.user-row .u-info h4 { font-size: 14px; font-weight: 700; }
.user-row .u-info p { font-size: 12px; color: var(--slate-500); }
.role-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.role-superadmin { background: var(--red-bg);   color: var(--brand-red-dark); }
.role-manager    { background: var(--blue-bg);  color: var(--blue); }
.role-reporter   { background: var(--slate-100); color: var(--slate-500); }
.u-del { background: none; border: none; cursor: pointer; color: var(--slate-400); font-size: 16px; padding: 6px; border-radius: 8px; }
.u-del:hover { background: var(--red-bg); color: var(--brand-red-dark); }
.u-del[disabled] { opacity: .3; cursor: not-allowed; }

/* ---- Barra de selección masiva (manager / superadmin) ------------------ */
.bulk-bar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--white); border: 1px solid var(--slate-200);
    border-radius: 12px; padding: 10px 16px; margin-bottom: 12px;
}
.bulk-bar[hidden] { display: none; }
.bulk-chk-label { display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600; color: var(--slate-500); cursor: pointer; -webkit-user-select: none; user-select: none; }
.bulk-chk-label input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand-red); }
.bulk-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.bulk-actions[hidden] { display: none; }
.bulk-count { font-size: 13px; font-weight: 700; color: var(--slate-500); white-space: nowrap; }
.req .bulk-chk { width: 17px; height: 17px; flex: none; cursor: pointer; accent-color: var(--brand-red); }
.req.selected { border-color: #fca5a5; background: #fff8f8; }

.empty { text-align: center; color: var(--slate-400); padding: 48px; font-size: 14px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff;
         padding: 12px 20px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-md); opacity: 0; transition: .3s; z-index: 100; }
.toast.show { opacity: 1; }

/* Jalar para recargar (pull-to-refresh) */
.ptr-indicator {
    position: fixed; top: 0; left: 50%; z-index: 2000;
    width: 40px; height: 40px; margin-top: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--white); border-radius: 50%; box-shadow: var(--shadow-md);
    transform: translateX(-50%) translateY(0); opacity: 0;
    pointer-events: none;
}
.ptr-indicator.snap { transition: transform .25s ease, opacity .25s ease; }
.ptr-spinner {
    width: 20px; height: 20px; border-radius: 50%;
    border: 3px solid var(--slate-200); border-top-color: var(--brand-red);
}
.ptr-indicator.ready .ptr-spinner { border-top-color: var(--green); }
.ptr-indicator.refreshing .ptr-spinner { animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* ---- Galería de capturas (varias por solicitud) ------------------------ */
/* Se ven grandes y claras; si hay varias, scroll horizontal. */
.shot-grid { display: flex; gap: 12px; overflow-x: auto; margin: 12px 0; padding-bottom: 10px; scroll-snap-type: x proximity; }
.shot-grid a { flex: 0 0 auto; max-width: 100%; scroll-snap-align: start; }
.shot-grid img { max-width: 100%; max-height: 70vh; border: 1px solid var(--slate-200); border-radius: 12px; display: block; background: var(--slate-100); }
.capture-list { display: flex; flex-wrap: nowrap; gap: 12px; margin-top: 10px; overflow-x: auto; padding: 6px 6px 10px; }
.capture-list .shot { position: relative; flex: 0 0 auto; }
.capture-list .shot img { height: 150px; width: auto; max-width: 360px; object-fit: contain;
    border-radius: 10px; border: 1px solid var(--slate-200); background: var(--slate-100); display: block; }
.capture-list .shot button { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 999px;
    border: 2px solid #fff; background: var(--brand-red); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; box-shadow: var(--shadow-sm); }

/* ---- Archivos de referencia -------------------------------------------- */
.file-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
    background: var(--slate-100); border: 1px solid var(--slate-200); border-radius: 10px;
    padding: 6px 10px; font-size: 13px; color: var(--slate-900); text-decoration: none; }
.file-chip a { color: var(--slate-900); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-chip small { color: var(--slate-400); font-size: 11px; flex: none; }
.file-chip button { flex: none; border: none; background: var(--brand-red); color: #fff; width: 18px; height: 18px;
    border-radius: 999px; font-size: 12px; line-height: 1; cursor: pointer; }

/* ---- Carga masiva ------------------------------------------------------ */
.bulk-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px; line-height: 1.5; min-height: 240px;
}
.bulk-preview { margin-top: 16px; }
#bulk-preview:empty { display: none; }
.bulk-empty { text-align: center; color: var(--slate-400); font-size: 13px; padding: 20px; }
.bulk-empty code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: var(--slate-200); padding: 1px 6px; border-radius: 6px; }
.bulk-rows { display: flex; flex-direction: column; border: 1px solid var(--slate-200); border-radius: 12px; overflow: hidden; }
.bulk-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    border-bottom: 1px solid var(--slate-100); cursor: pointer; }
.bulk-row:last-child { border-bottom: none; }
.bulk-row input[type=checkbox] { width: 16px; height: 16px; flex: none; cursor: pointer; accent-color: var(--brand-red); }
.bulk-rf-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--slate-900);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulk-rf-prio { flex: none; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    background: var(--slate-100); color: var(--slate-500); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.bulk-row.is-dup { opacity: .55; }
.bulk-dup-tag { font-style: normal; font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--amber); margin-left: 6px; }
.bulk-ignored { margin-top: 10px; font-size: 12px; color: var(--slate-500);
    background: var(--amber-bg); border-radius: 10px; padding: 8px 12px; }
.bulk-ignored span { color: var(--slate-400); }
.bulk-actions-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.bulk-mode { display: flex; gap: 14px; flex-wrap: wrap; }
.bulk-mode label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
    color: var(--slate-500); cursor: pointer; }
.bulk-mode input[type=radio] { accent-color: var(--brand-red); cursor: pointer; }
.bulk-sel-count { font-size: 13px; font-weight: 700; color: var(--slate-500); white-space: nowrap; margin-left: auto; }
.bulk-actions-bar .btn { flex: none; }

/* ---- Botón flotante de instalación (PWA) -------------------------------- */
/* Oculto por defecto; app.js lo muestra solo si la app no está instalada. */
.install-fab {
    position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 90;
    width: 48px; height: 48px; border-radius: 999px; border: none; cursor: pointer;
    background: var(--navy); color: #fff; font-size: 19px; line-height: 1;
    box-shadow: var(--shadow-md); display: flex; align-items: center; justify-content: center;
    transition: transform .15s, background .15s;
}
.install-fab:hover { background: var(--slate-900); transform: translateY(-2px); }
.install-fab[hidden] { display: none; }

/* ---- Versión de la app ------------------------------------------------- */
.app-version { text-align: center; color: var(--slate-400); font-size: 12px; letter-spacing: .02em; padding: 20px 16px 32px; }

/* ---- Responsive (móvil) ------------------------------------------------ */
@media (max-width: 640px) {
    .topbar { padding: 10px 14px; }
    .topbar .brand { font-size: 15px; gap: 8px; }
    .topbar .brand span { white-space: nowrap; }
    .topbar .brand small { display: none; }
    .topbar .right { gap: 8px; }
    .topbar .who { display: none; }
    .topbar .topbar-left { gap: 10px; }
    .topbar .avatar { width: 34px; height: 34px; }
    .project-switcher .ps-select { max-width: 150px; padding: 7px 10px; font-size: 12px; }
    .project-switcher .ps-static { max-width: 150px; font-size: 12px; }
    .project-context { margin-top: 6px; }
    .btn { padding: 10px 14px; font-size: 13px; }
    .btn-sm { padding: 6px 10px; font-size: 12px; }
    .toolbar { gap: 10px; }
    /* Acciones en cuadrícula compacta: 2 por fila, el botón primario a lo ancho. */
    .toolbar-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; width: 100%; }
    .toolbar-actions .btn { justify-content: center; padding: 9px 8px; font-size: 12.5px; white-space: nowrap; }
    .toolbar-actions .btn-primary { grid-column: 1 / -1; }
    .wrap { padding: 18px 16px; }
    .page-title { font-size: 22px; }
    .page-sub { font-size: 13px; }
    .modal-backdrop { padding: 16px 10px; }
    .modal header { padding: 18px 16px 0; }
    .modal .body { padding: 16px; }
    .notif-panel { top: 62px; right: 10px; left: 10px; width: auto; }
    /* KPIs compactos: 3 por fila en vez de tarjetas gigantes apiladas. */
    .kpis { grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
    .kpi { padding: 10px 8px 8px; border-radius: 12px; }
    .kpi .label { font-size: 9px; letter-spacing: .06em; }
    .kpi .value { font-size: 20px; margin-top: 2px; }
    .list-tools .search { min-width: 0; }
    .req { padding: 12px; gap: 10px; }
    .req .meta { font-size: 10px; }
    .install-fab { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); width: 44px; height: 44px; }
}

/* Pantallas muy angostas: el header cede antes de desbordar. */
@media (max-width: 420px) {
    .topbar { padding: 10px 10px; }
    .topbar .brand { font-size: 14px; }
    .project-switcher .ps-select, .project-switcher .ps-static { max-width: 110px; font-size: 11px; }
    .bell { width: 36px; height: 36px; font-size: 16px; }
    .topbar .avatar { width: 32px; height: 32px; }
    .toolbar-actions .btn { font-size: 12px; }
}
