/* ==========================================================================
   AsesoriaWeb — paneles de gestión y de clientes (mobile-first)
   Breakpoints: 600px, 992px
   ========================================================================== */

:root {
    --accent: #e74c3c;
    --accent-dark: #c0392b;
    --navy: #223d61;
    --navy-dark: #172a44;
    --bg: #f4f5f9;
    --card: #fff;
    --line: #e3e5ec;
    --text: #4f545b;
    --muted: #7a7f87;
    --heading: #23272e;
    --ok: #12804a;
    --warn: #a36100;
    --error: #b42318;
    --info: #1d5fa8;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(23, 42, 68, .08), 0 1px 2px rgba(23, 42, 68, .04);
    --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --topbar-h: 56px;
    --sidebar-w: 240px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font: 400 .9375rem/1.55 var(--font);
    color: var(--text);
    background: var(--bg);
}

h1,
h2,
h3,
.h3,
.h4 {
    margin: 0 0 .5em;
    font-weight: 700;
    line-height: 1.25;
    color: var(--heading);
}

h1 {
    font-size: 1.375rem;
}

h2,
.h3 {
    font-size: 1.125rem;
}

h3,
.h4 {
    font-size: 1rem;
}

p {
    margin: 0 0 1em;
}

a {
    color: var(--navy);
}

a:hover {
    color: var(--accent-dark);
}

code,
pre {
    font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
    font-size: .875em;
}

[hidden] {
    display: none !important;
}

.icon {
    width: 1.15em;
    height: 1.15em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -.2em;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 100;
    padding: 8px 14px;
    background: #fff;
}

.skip-link:focus {
    left: 8px;
}

:focus-visible {
    outline: 3px solid rgba(34, 61, 97, .45);
    outline-offset: 2px;
}

.brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: -.01em;
}

.brand span {
    color: var(--accent);
}

.brand small {
    margin-left: 6px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    opacity: .7;
}

/* Barra superior y menú lateral
   ========================================================================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-h);
    padding: 0 12px;
    background: var(--navy-dark);
    color: #fff;
}

.topbar .brand:hover {
    color: #fff;
}

.topbar_menu {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
}

.topbar_user {
    margin-left: auto;
    min-width: 0;
}

.topbar_who {
    display: none;
    text-align: right;
    line-height: 1.2;
}

.topbar_who strong,
.topbar_who small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 220px;
}

.topbar_who small {
    font-size: .75rem;
    opacity: .7;
}

.sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    z-index: 25;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: min(var(--sidebar-w), 82vw);
    padding: 12px 8px;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid var(--line);
    transform: translateX(-100%);
    transition: transform .2s ease;
}

.nav-open .sidebar {
    transform: none;
}

.sidebar_backdrop {
    position: fixed;
    inset: var(--topbar-h) 0 0;
    z-index: 20;
    background: rgba(23, 42, 68, .4);
}

.sidebar ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar_bottom {
    padding-top: 12px !important;
    border-top: 1px solid var(--line);
}

.sidebar a,
.sidebar button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.sidebar a:hover,
.sidebar button:hover {
    background: var(--bg);
    color: var(--heading);
}

.sidebar a[aria-current="page"] {
    background: #e9eef6;
    color: var(--navy);
}

.nav_count {
    margin-left: auto;
    min-width: 22px;
    padding: 0 7px;
    border-radius: 11px;
    background: var(--accent-dark);
    color: #fff;
    font-size: .75rem;
    line-height: 22px;
    text-align: center;
}

.main {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 12px 48px;
}

.impersonate_bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: #fff4d6;
    color: #6b4500;
    font-size: .875rem;
}

.impersonate_bar form {
    margin: 0;
}

/* Encabezado de página
   ========================================================================== */
.page_head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.page_head h1 {
    margin: 0;
}

.page_lead {
    margin: 4px 0 0;
    color: var(--muted);
}

.page_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.back_link {
    display: inline-block;
    margin-bottom: 4px;
    font-size: .875rem;
    text-decoration: none;
}

/* Tarjetas, métricas y detalles
   ========================================================================== */
.card {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
}

.card > :last-child {
    margin-bottom: 0;
}

.card_head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.card_head h2 {
    margin: 0;
}

.card.is-flush {
    padding: 0;
    overflow: hidden;
}

.card.is-flush .card_head {
    margin: 0;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
}

a.stat:hover {
    border-color: var(--navy);
    color: inherit;
}

.stat_label {
    display: block;
    font-size: .8125rem;
    color: var(--muted);
}

.stat_value {
    display: block;
    margin-top: 2px;
    font-size: 1.625rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--heading);
    font-variant-numeric: tabular-nums;
}

.stat.is-alert .stat_value {
    color: var(--accent-dark);
}

.grid {
    display: grid;
    gap: 16px;
}

.grid > * > .card:last-child {
    margin-bottom: 0;
}

.grid + .form_actions,
.grid + .card {
    margin-top: 16px;
}

.details {
    display: grid;
    grid-template-columns: minmax(110px, 35%) 1fr;
    gap: 8px 16px;
    margin: 0;
}

.details dt {
    color: var(--muted);
    font-size: .875rem;
}

.details dd {
    margin: 0;
    color: var(--heading);
    word-break: break-word;
}

.plain_list {
    margin: 0 0 1em;
    padding-left: 1.2em;
}

.empty {
    padding: 24px 16px;
    color: var(--muted);
    text-align: center;
}

.empty_state {
    max-width: 480px;
    margin: 48px auto;
    text-align: center;
}

.empty_state > .icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    color: var(--muted);
}

.note_box {
    padding: 12px 14px;
    border-left: 4px solid #e0b252;
    border-radius: 4px;
    background: #fffaf0;
    white-space: pre-line;
}

/* Tablas: en el celular cada fila se vuelve una tarjeta
   ========================================================================== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
}

.table td,
.table th {
    padding: 10px 16px;
    vertical-align: top;
}

.table td.num,
.table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.table .row_link {
    font-weight: 600;
    text-decoration: none;
}

.table small {
    display: block;
    color: var(--muted);
}

@media (max-width: 767.98px) {
    .table thead {
        display: none;
    }

    .table tr {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid var(--line);
    }

    .table td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 4px 16px;
        text-align: right;
    }

    .table td::before {
        content: attr(data-label);
        flex: none;
        color: var(--muted);
        font-size: .8125rem;
        text-align: left;
    }

    .table td:first-child {
        display: block;
        text-align: left;
    }

    .table td:first-child::before {
        content: none;
    }

    .table td.num {
        text-align: right;
    }
}

@media (min-width: 768px) {
    .table tr {
        border-bottom: 1px solid var(--line);
    }

    .table tbody tr:last-child {
        border-bottom: 0;
    }

    .table tbody tr:hover {
        background: #fafbfd;
    }
}

/* Filtros y paginación
   ========================================================================== */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filters .input {
    flex: 1 1 200px;
    width: auto;
}

.filters select.input {
    flex: 0 1 180px;
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
}

.tabs a {
    flex: none;
    padding: 10px 14px;
    border-bottom: 2px solid transparent;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.tabs a[aria-current="page"] {
    border-color: var(--accent);
    color: var(--heading);
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    font-size: .875rem;
}

/* Formularios
   ========================================================================== */
fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

legend {
    padding: 0;
}

.stack > * + * {
    margin-top: 14px;
}

.field label,
.field_label {
    display: block;
    margin-bottom: 4px;
    font-size: .875rem;
    font-weight: 600;
    color: var(--heading);
}

.input {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid #c9ced8;
    border-radius: var(--radius);
    background: #fff;
    color: var(--heading);
    /* 16px evita el zoom automático de iOS */
    font: 400 1rem/1.4 var(--font);
}

select.input {
    appearance: none;
    padding-right: 36px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 10px center / 16px no-repeat;
}

textarea.input {
    min-height: 96px;
    resize: vertical;
}

.input:focus {
    outline: 0;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(34, 61, 97, .18);
}

.input[aria-invalid="true"] {
    border-color: var(--error);
}

.input-code {
    font-size: 1.5rem;
    letter-spacing: .3em;
    text-align: center;
}

.hint {
    margin: 4px 0 0;
    font-size: .8125rem;
    color: var(--muted);
}

.field_error {
    margin: 4px 0 0;
    font-size: .8125rem;
    color: var(--error);
}

.form_grid {
    display: grid;
    gap: 14px 16px;
}

.form_grid .span-all {
    grid-column: 1 / -1;
}

.check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 400 !important;
    cursor: pointer;
}

.check input {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    flex: none;
    accent-color: var(--navy);
}

.form_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.inline_form {
    display: inline;
    margin: 0;
}

.price_grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 12px;
}

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Botones, etiquetas y avisos
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--accent-dark);
    color: #fff;
    font: 600 .9375rem/1.2 var(--font);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.btn:hover {
    background: #a5311f;
    color: #fff;
}

.btn:disabled {
    opacity: .6;
    cursor: default;
}

.btn-sm {
    min-height: 34px;
    padding: 5px 12px;
    font-size: .875rem;
}

.btn-dark {
    background: var(--navy);
}

.btn-dark:hover {
    background: var(--navy-dark);
}

.btn-light {
    border-color: #c9ced8;
    background: #fff;
    color: var(--heading);
}

.btn-light:hover {
    border-color: var(--navy);
    background: #fff;
    color: var(--navy);
}

.btn-danger {
    border-color: #f1b8b2;
    background: #fff;
    color: var(--error);
}

.btn-danger:hover {
    background: var(--error);
    color: #fff;
}

.btn-ok {
    background: var(--ok);
}

.btn-ok:hover {
    background: #0c6439;
}

.btn-block {
    width: 100%;
}

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-ok {
    background: #e3f4ea;
    color: var(--ok);
}

.badge-warn {
    background: #fdf1dc;
    color: var(--warn);
}

.badge-error {
    background: #fde7e5;
    color: var(--error);
}

.badge-info {
    background: #e4eefa;
    color: var(--info);
}

.badge-muted {
    background: #eceef2;
    color: var(--muted);
}

.alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: .9375rem;
}

.alert > :last-child {
    margin-bottom: 0;
}

.alert-error {
    background: #fde7e5;
    color: #7d1a11;
}

.alert-success {
    background: #e3f4ea;
    color: #0b5532;
}

.alert-info {
    background: #e4eefa;
    color: #163f6e;
}

.alert-warn {
    background: #fdf1dc;
    color: #6b4500;
}

.code_box {
    margin: 8px 0 0;
    padding: 10px 12px;
    overflow-x: auto;
    border-radius: 6px;
    background: #fff;
    color: var(--heading);
    white-space: pre-wrap;
    word-break: break-all;
}

.checklist {
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.checklist li {
    display: flex;
    gap: 10px;
    padding: 6px 0;
}

.checklist small {
    display: block;
    color: var(--muted);
}

.checklist .is-ok .icon {
    color: var(--ok);
}

.checklist .is-fail .icon {
    color: var(--error);
}

/* Información privada de los servicios */
.secret {
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.secret:first-child {
    border-top: 0;
    padding-top: 0;
}

.secret_head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.secret_value {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.secret_value code {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg);
    word-break: break-all;
}

.icon_btn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.icon_btn:hover {
    border-color: var(--navy);
    color: var(--navy);
}

/* Diferencias del registro de actividad */
.diff {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.diff th,
.diff td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    word-break: break-word;
}

.diff .old {
    background: #fff3f2;
}

.diff .new {
    background: #f0faf4;
}

/* Agente asignado */
.agent {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.agent_avatar {
    display: grid;
    flex: none;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
}

.agent_contact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.qr {
    display: inline-block;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.qr svg {
    display: block;
    width: 200px;
    height: 200px;
}

.codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin: 0 0 1em;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--bg);
    list-style: none;
    font-family: ui-monospace, Consolas, monospace;
}

/* Barras simples (contrataciones por mes) */
.bars {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bars li {
    display: grid;
    grid-template-columns: 36px 1fr 32px;
    gap: 10px;
    align-items: center;
    padding: 4px 0;
    font-size: .875rem;
}

.bar {
    height: 10px;
    border-radius: 5px;
    background: var(--bg);
    overflow: hidden;
}

.bar span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: 5px;
    background: var(--navy);
}

.bars strong {
    text-align: right;
    color: var(--heading);
    font-variant-numeric: tabular-nums;
}

details > summary {
    margin: 8px 0;
    color: var(--navy);
    font-weight: 600;
    cursor: pointer;
}

.icon_btn.is-done {
    border-color: var(--ok);
    color: var(--ok);
}

/* Diagnóstico del correo */
.mail_diag {
    margin-top: 18px;
}

.diag_steps {
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.diag_steps li {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.diag_steps li > .icon {
    margin-top: 3px;
}

.diag_steps p {
    margin: 2px 0 0;
    word-break: break-word;
}

.diag_steps .is-ok > .icon {
    color: var(--ok);
}

.diag_steps .is-fail > .icon {
    color: var(--error);
}

.diag_steps .is-warn > .icon {
    color: var(--warn);
}

.diag_log {
    max-height: 320px;
    overflow: auto;
    background: #1f2430;
    color: #e6e6e6;
    font-size: .75rem;
    white-space: pre-wrap;
}

/* Editor de correos */
.editor_tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.editor_tools .btn {
    min-height: 30px;
    padding: 3px 9px;
    font-size: .8125rem;
}

.code_input {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .875rem;
    line-height: 1.5;
}

.mail_preview {
    display: block;
    width: 100%;
    height: 560px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #eef0f4;
}

/* Catálogo del panel de clientes */
.section_title {
    margin: 8px 0 12px;
    font-size: 1rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.product_grid {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.product_card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin: 0;
}

.product_card h3 {
    margin: 4px 0 0;
}

.product_card .btn {
    margin-top: auto;
}

.product_price {
    margin: 4px 0 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--heading);
}

.product_price small {
    font-size: .8125rem;
    font-weight: 400;
    color: var(--muted);
}

/* Notas de venta */
.lines {
    margin: 0 0 16px;
    padding: 0;
    border: 0;
}

.line_row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
}

.line_desc {
    grid-column: 1 / -1;
}

.totals {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 24px;
    max-width: 360px;
    margin: 12px 0 8px auto;
    padding: 0 16px;
}

.totals dt {
    color: var(--muted);
}

.totals dd {
    margin: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.totals .total {
    padding-top: 4px;
    border-top: 1px solid var(--line);
    color: var(--heading);
    font-weight: 700;
}

.card > .invoice_items {
    margin: 0 -16px;
    width: calc(100% + 32px);
}

.proof_img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.qr_preview {
    display: block;
    width: 220px;
    max-width: 100%;
    margin: 6px 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.row_total td {
    background: var(--bg);
}

.bars.is-wide li {
    grid-template-columns: 54px 1fr minmax(90px, auto);
}

/* Hoja para imprimir (Ctrl + P o "Guardar como PDF") */
.print_page {
    background: #e9ebf0;
}

.print_actions {
    max-width: 800px;
    margin: 16px auto 0;
    padding: 0 12px;
    text-align: right;
}

.print_sheet {
    position: relative;
    max-width: 800px;
    margin: 16px auto 40px;
    padding: 32px 24px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow);
}

.print_head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--navy);
    font-size: .875rem;
}

.print_company {
    font-size: 1.125rem;
    color: var(--heading);
}

.print_title {
    text-align: right;
}

.print_title h1 {
    margin: 0 0 4px;
    font-size: 1.25rem;
    letter-spacing: .06em;
    color: var(--navy);
}

.print_client {
    display: grid;
    gap: 2px 24px;
    margin: 16px 0;
    font-size: .875rem;
}

.print_client span {
    color: var(--muted);
}

.print_pay {
    margin-top: 16px;
    font-size: .875rem;
}

.print_foot {
    margin-top: 28px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .75rem;
    text-align: center;
}

.print_stamp {
    position: absolute;
    top: 62%;
    left: 50%;
    padding: 6px 24px;
    border: 4px solid currentColor;
    border-radius: 8px;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: .1em;
    opacity: .18;
    transform: translate(-50%, -50%) rotate(-18deg);
    pointer-events: none;
}

.print_stamp.is-paid {
    color: var(--ok);
}

.print_stamp.is-cancelled {
    color: var(--error);
}

.print_sheet .table td,
.print_sheet .table th {
    padding: 8px 6px;
}

@media print {
    .print_page {
        background: #fff;
    }

    .print_actions {
        display: none;
    }

    .print_sheet {
        max-width: none;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    .print_sheet .table thead {
        display: table-header-group;
    }

    .print_sheet .table tr {
        display: table-row;
        border-bottom: 1px solid var(--line);
    }

    .print_sheet .table td {
        display: table-cell;
        text-align: inherit;
    }

    .print_sheet .table td::before {
        content: none;
    }

    .print_sheet .table td.num {
        text-align: right;
    }
}

/* Pantallas de acceso
   ========================================================================== */
.auth {
    background: var(--navy-dark);
}

.auth_wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    min-height: 100vh;
    padding: 40px 16px;
}

.auth_card {
    width: 100%;
    max-width: 420px;
    padding: 24px 20px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

.auth_wrap.is-wide .auth_card {
    max-width: 640px;
}

.auth_links {
    margin: 16px 0 0;
    font-size: .875rem;
    text-align: center;
}

/* Responsive
   ========================================================================== */
@media (min-width: 600px) {
    .main {
        padding: 24px 24px 56px;
    }

    .stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .form_grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .price_grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .line_row {
        grid-template-columns: 1fr 90px 150px;
    }

    .product_grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .line_desc {
        grid-column: auto;
    }

    .print_client {
        grid-template-columns: 1fr 1fr;
    }

    .print_sheet {
        padding: 48px;
    }

    .card {
        padding: 20px;
    }

    .auth_card {
        padding: 32px;
    }

    .topbar_who {
        display: block;
    }
}

@media (min-width: 992px) {
    .topbar_menu,
    .sidebar_backdrop {
        display: none !important;
    }

    .topbar {
        padding: 0 20px;
    }

    .shell {
        display: flex;
    }

    .sidebar {
        position: sticky;
        height: calc(100vh - var(--topbar-h));
        transform: none;
        flex: none;
        width: var(--sidebar-w);
    }

    .main {
        padding: 28px 32px 64px;
    }

    .grid.two {
        grid-template-columns: 1.4fr 1fr;
        align-items: start;
    }

    .grid.halves {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }

    .product_grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar {
        transition: none;
    }
}

/* Tickets: conversación
   ------------------------------------------------------------------ */
.thread {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.msg {
    max-width: 86%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.msg.is-client {
    justify-self: start;
    background: #f7f8fb;
}

.msg.is-staff {
    justify-self: end;
    border-color: #cfdcef;
    background: #eef4fc;
}

.msg.is-internal {
    justify-self: end;
    border-style: dashed;
    border-color: #e6c27a;
    background: #fff8e8;
}

.msg.is-system {
    justify-self: center;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: none;
}

.msg_head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 0 0 6px;
}

.msg_head strong {
    color: var(--heading);
}

.msg_head small,
.msg_system small {
    color: var(--muted);
}

.msg_body {
    overflow-wrap: anywhere;
    color: var(--text);
    line-height: 1.55;
}

.msg_file {
    margin: 10px 0 0;
}

.msg_file a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.msg_system {
    margin: 0;
    color: var(--muted);
    font-size: .875rem;
    text-align: center;
}

@media (max-width: 640px) {
    .msg {
        max-width: 100%;
    }
}
