/* Sistema de Tickets — capa propia sobre Bootstrap 5.3 + AdminLTE 4 (todo local; CSP estricta).
   Usa variables de Bootstrap (--bs-*) para respetar modo claro/oscuro. */

/* Utilidades heredadas de las vistas */
.muted { color: var(--bs-secondary-color); }
.center { text-align: center; }
.mt { margin-top: 1rem; }
.break { word-break: break-all; }
code { background: var(--bs-tertiary-bg); padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.linklike { background: none; border: 0; padding: 0; color: var(--bs-link-color); cursor: pointer; font: inherit; }

/* Acceso */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(160deg, #0f1d33 0%, #1b3a78 100%); }
.auth-card { width: 100%; max-width: 26rem; border: 0; border-radius: 1rem; }
.auth-card h1 { font-size: 1.2rem; text-align: center; }
.auth-card .muted { text-align: center; }

/* Cabecera de página y filtros */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1, .page-head h2 { margin: 0; }
.filters { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: end; }
.filters label { font-size: .8rem; font-weight: 600; }
.filters .form-control, .filters .form-select { width: auto; min-width: 10rem; margin-top: .25rem; }

/* Formularios */
.field { display: block; margin-bottom: 1rem; font-weight: 600; font-size: .9rem; }
.field .form-control, .field .form-select { margin-top: .3rem; font-weight: 400; }
.field small { display: block; font-weight: 400; margin-top: .25rem; }
.form-narrow { max-width: 42rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 1rem; align-items: end; }
.form-actions { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; grid-column: 1 / -1; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form .form-control { width: auto; flex: 1 1 12rem; min-width: 0; max-width: 100%; }
.checks label, label.checks { display: inline-flex; gap: .4rem; align-items: center; margin-right: 1rem; font-weight: 400; }
fieldset.field { border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .7rem 1rem; }
fieldset.field legend { float: none; width: auto; font-size: .9rem; padding: 0 .4rem; font-weight: 600; }
.actions { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* Tablas */
.table-wrap { overflow-x: auto; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .6rem; box-shadow: var(--bs-box-shadow-sm); }
.card-body .table-wrap { border: 0; box-shadow: none; border-radius: 0; }
.table-wrap .table > thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); background: var(--bs-tertiary-bg); white-space: nowrap; }
.table td .form-control, .table td .form-select { margin: 0; min-width: 6rem; }
.table td small { display: block; }

/* Alertas con credenciales temporales */
.alert-secret { font-family: ui-monospace, Consolas, monospace; white-space: pre-wrap; font-size: .95rem; }

/* Panel */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .6rem; padding: 1rem 1.2rem; box-shadow: var(--bs-box-shadow-sm); display: flex; flex-direction: column; }
.stat-n { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat-l { color: var(--bs-secondary-color); font-size: .85rem; }
.stat-danger .stat-n { color: var(--bs-danger); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 11rem 1fr 2.5rem; gap: .6rem; align-items: center; padding: .25rem 0; }
.bars b { text-align: right; }
progress { width: 100%; height: .6rem; accent-color: var(--bs-primary); }
.recent { list-style: none; padding: 0; margin: 0; }
.recent li { padding: .55rem 0; border-bottom: 1px solid var(--bs-border-color); }
.recent li:last-child { border: 0; }

/* 2FA, códigos y notificaciones */
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: 1.25rem; }
.secret-box { background: var(--bs-tertiary-bg); border: 1px dashed var(--bs-border-color); border-radius: .5rem; padding: .8rem 1rem; margin: .5rem 0; font-size: 1.2rem; letter-spacing: .08em; }
.qr-box { display: inline-block; background: #fff; padding: .5rem; border: 1px solid var(--bs-border-color); border-radius: .5rem; margin: .5rem 0; line-height: 0; }
.qr-box svg { width: 220px; height: 220px; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; max-width: 22rem; }
.codes code { font-size: 1.1rem; display: block; text-align: center; padding: .5rem; }
.notif-list { list-style: none; padding: 0; }
.notif-list li { padding: .7rem 1rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .5rem; margin-bottom: .5rem; display: flex; justify-content: space-between; gap: 1rem; }
.notif-list li.unread { border-left: 4px solid var(--bs-primary); font-weight: 600; }

/* Tickets: línea de tiempo */
.ticket-timeline { list-style: none; padding: 0; margin: 0; }
.ticket-timeline::before { content: none; }
.tl-item { padding: .8rem 1rem; border-radius: .6rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); margin-bottom: .7rem; }
.tl-internal { background: var(--bs-warning-bg-subtle); border-color: var(--bs-warning-border-subtle); }
.tl-client { border-left: 4px solid var(--bs-primary); }
.tl-event { background: transparent; border: 0; padding: .2rem 1rem; color: var(--bs-secondary-color); font-size: .88rem; }
.tl-meta { color: var(--bs-secondary-color); font-size: .82rem; margin-bottom: .3rem; }

@media (max-width: 860px) { .bars li { grid-template-columns: 7rem 1fr 2rem; } }
@media print { .app-sidebar, .app-header, .navbar, .app-footer, [data-print] { display: none !important; } body { background: #fff; } }

/* Logo de la empresa */
.brand-logo { max-height: 4.5rem; max-width: 14rem; object-fit: contain; }
.nav-logo { height: 28px; width: auto; max-width: 9rem; object-fit: contain; }
.sidebar-brand .brand-link { display: flex; align-items: center; justify-content: center; padding: .4rem .8rem; }
.brand-plate { display: flex; align-items: center; justify-content: center; background: #fff; border-radius: .5rem; padding: .25rem .6rem; width: 100%; }
.sidebar-brand .brand-plate .brand-image { max-height: 42px; width: auto; max-width: 100%; object-fit: contain; margin: 0; }
.brand-logo { background: #fff; }
.nav-logo { background: #fff; border-radius: .35rem; padding: 2px 6px; }
.logo-preview { min-width: 10rem; min-height: 4rem; display: grid; place-items: center; padding: .5rem 1rem; border: 1px dashed var(--bs-border-color); border-radius: .5rem; background: var(--bs-tertiary-bg); }
.logo-preview img { max-height: 5rem; max-width: 14rem; object-fit: contain; }

/* Pulido visual */
.app-main a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not(.list-group-item),
.navbar-brand { text-decoration: none; }
.app-main a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):hover { text-decoration: underline; }
.table td a.fw-semibold, .table td > a:first-child { font-weight: 600; white-space: nowrap; }
.notif-badge { position: absolute; top: 2px; right: -2px; font-size: .62rem; font-weight: 600; line-height: 1; padding: .28em .45em; min-width: 1.4em; }
@media (max-width: 575.98px) { h1 { font-size: 1.3rem; } .page-head .btn { white-space: nowrap; } }
.logo-form { flex: 1 1 16rem; min-width: 0; }
