:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --ink: #0f172a;
    --ink-soft: #475569;
    --ink-muted: #64748b;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --accent: #0d9488;
    --accent-dark: #0f766e;
    --accent-soft: #ccfbf1;
    --danger-bg: #fef2f2;
    --danger-line: #fecaca;
    --danger-ink: #991b1b;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .18);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

/* ---------- Barra superior ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(120deg, #0f172a 0%, #134e4a 100%);
    color: #e2e8f0;
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .07);
}

.topbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 10px 24px;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    border-radius: 12px;
}

.brand:focus-visible {
    outline: 2px solid rgba(45, 212, 191, .7);
    outline-offset: 3px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(45, 212, 191, .16);
    border: 1px solid rgba(45, 212, 191, .35);
    font-size: 20px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    display: block;
    flex: 0 0 auto;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .35));
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
}

/* Indicador de conexión */
.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(45, 212, 191, .26);
    background: rgba(45, 212, 191, .1);
    color: #99f6e4;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .4px;
    white-space: nowrap;
}

.status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2dd4bf;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, .18);
}

/* Botón instalar app */
.btn-install {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    border-radius: 999px;
    border: 1px solid rgba(45, 212, 191, .45);
    background: rgba(45, 212, 191, .16);
    color: #ccfbf1;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.btn-install svg {
    width: 15px;
    height: 15px;
}

.btn-install:hover {
    background: rgba(45, 212, 191, .3);
    border-color: rgba(45, 212, 191, .7);
}

/* ---------- Menú de cuenta ---------- */
.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 40px;
    max-width: 250px;
    padding: 3px 11px 3px 3px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .26);
    background: rgba(255, 255, 255, .07);
    color: #e2e8f0;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.user-menu-toggle:hover {
    background: rgba(255, 255, 255, .13);
    border-color: rgba(148, 163, 184, .45);
}

.user-menu-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, .15);
    border-color: rgba(45, 212, 191, .55);
}

.user-menu-toggle:focus-visible {
    outline: 2px solid rgba(45, 212, 191, .7);
    outline-offset: 2px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, #5eead4, #0d9488);
    color: #04302b;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .4px;
}

.user-menu-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-toggle .chevron {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    opacity: .65;
    transition: transform .18s ease;
}

.user-menu-toggle[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 60;
    width: 264px;
    padding: 8px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 24px 48px -24px rgba(15, 23, 42, .55), 0 2px 8px rgba(15, 23, 42, .08);
    color: var(--ink);
    animation: menu-in .14s ease-out;
}

@keyframes menu-in {
    from { opacity: 0; transform: translateY(-6px) scale(.98); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .user-menu-panel { animation: none; }
}

.user-menu-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 10px 11px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--line);
}

.user-menu-head-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-head-email {
    font-size: 11.5px;
    color: var(--ink-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-head-role {
    margin-top: 4px;
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .6px;
    text-transform: uppercase;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .12s, color .12s;
}

.user-menu-item svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    opacity: .7;
}

.user-menu-item:hover,
.user-menu-item:focus-visible {
    background: #f1f5f9;
    color: var(--ink);
    outline: none;
}

.user-menu-item.active {
    background: #ecfdf5;
    color: var(--accent-dark);
}

.user-menu-item.active svg {
    opacity: 1;
}

.user-menu-item.danger {
    color: var(--danger-ink);
}

.user-menu-item.danger svg {
    opacity: .8;
}

.user-menu-item.danger:hover,
.user-menu-item.danger:focus-visible {
    background: var(--danger-bg);
    color: var(--danger-ink);
}

.user-menu-sep {
    height: 1px;
    margin: 6px 4px;
    background: var(--line);
}

.user-menu form {
    margin: 0;
}

.ios-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: calc(100% - 48px);
    max-width: 1392px;
    margin: 14px auto 0;
    padding: 10px 14px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 12px;
    color: #065f46;
    font-size: 13px;
    line-height: 1.4;
}

.ios-hint button {
    flex: none;
    border: 0;
    background: transparent;
    color: #065f46;
    font-size: 15px;
    line-height: 1;
    padding: 4px;
    cursor: pointer;
}

.brand-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .2px;
    color: #f8fafc;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Página ---------- */
.page {
    max-width: 1440px;
    margin: 0 auto;
    padding: 22px 24px 8px;
}

.footer {
    max-width: 1440px;
    margin: 0 auto;
    padding: 12px 24px 28px;
    color: var(--ink-soft);
    font-size: 12px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ---------- Filtros ---------- */
.filters {
    padding: 18px 20px 14px;
    margin-bottom: 18px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
    gap: 14px;
    align-items: end;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field > span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.field select,
.field input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.field select:focus,
.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}

.field-static {
    display: flex;
    align-items: center;
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--ink-soft);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}

.btn.primary {
    background: var(--accent-dark);
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(13, 148, 136, .9);
}

.btn.primary:hover { background: #115e59; }

.btn.ghost {
    background: #fff;
    border-color: var(--line-strong);
    color: var(--ink-soft);
}

.btn.ghost:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
}

.presets {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
    font-size: 12.5px;
    color: var(--ink-muted);
}

.presets a {
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 600;
}

.presets a:hover { text-decoration: underline; }

/* ---------- Resumen ---------- */
.summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow);
}

.stat.highlight {
    background: linear-gradient(135deg, #0f766e, #115e59);
    border-color: transparent;
    color: #f0fdfa;
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .7px;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.stat.highlight .stat-label { color: #99f6e4; }

.stat-value {
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -.3px;
}

.stat-value.small { font-size: 16px; }

.stat-foot {
    font-size: 12px;
    color: var(--ink-muted);
}

.stat.highlight .stat-foot { color: #ccfbf1; }

/* ---------- Informe ---------- */
.report-card {
    overflow: hidden;
}

.report-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.report-head h1 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -.2px;
}

.report-head p {
    margin: 2px 0 0;
    color: var(--ink-muted);
    font-size: 12.5px;
}

.report-head .count {
    font-size: 12px;
    color: var(--ink-soft);
    background: #f1f5f9;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 12px;
    white-space: nowrap;
}

.table-wrap {
    overflow-x: auto;
}

table.report {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

table.report th,
table.report td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.report col.c-conector { width: 96px; }
table.report col.c-tipo { width: 190px; }
table.report col.c-num { width: 110px; }
table.report col.c-num.wide { width: 130px; }
table.report col.c-time { width: 108px; }

table.report thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    font-size: 11px;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--ink-soft);
    border-bottom: 2px solid var(--line-strong);
}

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

table.report tbody.day + tbody.day { border-top: 2px solid var(--line-strong); }

.day-row td {
    background: #ecfdf5;
    border-bottom: 1px solid #a7f3d0;
    padding: 9px 14px;
}

.day-label {
    font-weight: 700;
    color: #065f46;
    text-transform: capitalize;
    font-size: 13.5px;
}

.day-meta {
    margin-left: 12px;
    color: #047857;
    font-size: 12px;
}

.type-row td {
    background: #f8fafc;
    font-weight: 700;
    color: var(--ink);
    font-size: 12.5px;
    border-bottom: 1px solid var(--line);
}

.type-row .type-name {
    color: var(--accent-dark);
    letter-spacing: .3px;
}

tr.detail td { color: var(--ink-soft); }

tr.detail:hover td { background: #f0fdfa; }

tr.detail td:nth-child(1),
tr.detail td:nth-child(2) {
    color: var(--ink);
    font-weight: 600;
}

.day-total td {
    background: #f1f5f9;
    font-weight: 700;
    color: var(--ink);
    border-bottom: 1px solid var(--line-strong);
}

.day-total td:first-child {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .6px;
    color: var(--ink-soft);
}

/* ---------- Total general ---------- */
.grand-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 16px 20px;
    background: #0f172a;
    color: #e2e8f0;
}

.gt-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
}

.gt-meta {
    font-size: 12px;
    color: #94a3b8;
}

.gt-values {
    display: flex;
    gap: 26px;
    flex-wrap: wrap;
}

.gt-values div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gt-values span {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #94a3b8;
}

.gt-values strong {
    font-size: 15px;
    color: #5eead4;
    font-variant-numeric: tabular-nums;
}

/* ---------- Estados ---------- */
.empty-state {
    padding: 54px 24px;
    text-align: center;
    color: var(--ink-soft);
}

.empty-state h2 {
    margin: 0 0 6px;
    font-size: 17px;
    color: var(--ink);
}

.empty-state p {
    margin: 0 0 16px;
    color: var(--ink-muted);
}

.alert {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-line);
    color: var(--danger-ink);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 13px;
    overflow-wrap: anywhere;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .filter-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
    .filter-actions { grid-column: span 2; }
    .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Teléfonos y tabletas pequeñas: el informe se convierte en tarjetas */
@media (max-width: 760px) {
    .topbar-inner {
        padding: 10px 14px;
        min-height: 56px;
        gap: 10px;
    }
    .brand { gap: 9px; }
    .brand-title { font-size: 15px; }
    .brand-logo { width: 34px; height: 34px; }
    .status { display: none; }
    .btn-install {
        width: 36px;
        height: 36px;
        padding: 0;
        justify-content: center;
    }
    .btn-install span { display: none; }
    .user-menu-name,
    .user-menu-toggle .chevron { display: none; }
    .user-menu-toggle {
        width: 40px;
        height: 40px;
        padding: 3px;
        justify-content: center;
    }
    .user-menu-panel {
        width: min(288px, calc(100vw - 28px));
    }
    .page { padding: 14px 12px 4px; }
    .ios-hint { width: calc(100% - 24px); }
    .footer { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }

    .filters { padding: 14px; }
    .filter-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .filter-grid .field:first-child { grid-column: 1 / -1; }
    .filter-grid .field:nth-child(4) { grid-column: 1 / -1; }
    .filter-actions {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .filter-actions .btn.primary { grid-column: 1 / -1; }
    .presets { gap: 10px; }

    .summary { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat { padding: 13px 14px; }
    .stat.highlight { grid-column: 1 / -1; }
    .stat-value { font-size: 19px; }
    .stat-value.small { font-size: 14px; }

    .report-head { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
    .report-head h1 { font-size: 16px; }

    .table-wrap { overflow: visible; }
    table.report { display: block; min-width: 0; }
    table.report colgroup,
    table.report thead { display: none; }
    table.report tbody.day {
        display: block;
        margin-bottom: 14px;
        border: 1px solid var(--line);
        border-radius: 12px;
        overflow: hidden;
        background: #fff;
    }
    .report tr { display: block; }
    table.report td { display: block; width: auto; border: 0; padding: 0; white-space: normal; }

    tr.day-row td {
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 10px 12px;
        background: #ecfdf5;
        border-bottom: 1px solid #a7f3d0;
    }
    .day-label { font-size: 13px; }
    .day-meta { margin-left: 0; font-size: 11.5px; }

    tr.type-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px 12px;
        padding: 10px 12px;
        background: #f8fafc;
        border-bottom: 1px solid var(--line);
    }
    tr.type-row td { font-size: 12px; border: 0; padding: 0; }
    tr.type-row td:first-child { display: none; }
    tr.type-row td.type-name {
        grid-column: 1 / -1;
        font-size: 12px;
        letter-spacing: .5px;
        text-transform: uppercase;
    }
    tr.type-row td.num { text-align: left; }
    tr.type-row td.num::before {
        content: attr(data-label) ": ";
        color: var(--ink-muted);
        font-weight: 400;
        font-size: 10px;
        letter-spacing: .4px;
        text-transform: uppercase;
    }

    tr.detail {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 9px 12px;
        padding: 12px;
        border-bottom: 1px solid var(--line);
    }
    tr.detail td { font-size: 13px; text-align: left; }
    tr.detail td.num { text-align: left; }
    tr.detail td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 1px;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: .5px;
        text-transform: uppercase;
        color: var(--ink-muted);
    }
    tr.detail td[data-label="id"] { font-size: 15px; }

    tr.day-total {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 9px 12px;
        padding: 12px;
        background: #f1f5f9;
    }
    tr.day-total td { font-size: 13px; text-align: left; border: 0; padding: 0; }
    tr.day-total td:first-child {
        grid-column: 1 / -1;
        font-size: 11px;
        letter-spacing: .6px;
        text-transform: uppercase;
        color: var(--ink-soft);
    }
    tr.day-total td.num::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 1px;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: .5px;
        text-transform: uppercase;
        color: var(--ink-muted);
    }

    .grand-total { flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px; }
    .gt-values { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; width: 100%; }
    .gt-values strong { font-size: 14px; }
}

@media (max-width: 640px) {
    .page { padding: 12px 10px 4px; }
    .filter-grid { grid-template-columns: 1fr; }
    .filter-grid .field:first-child,
    .filter-grid .field:nth-child(4) { grid-column: auto; }
    .filter-actions { grid-column: auto; }
    .summary { grid-template-columns: 1fr; }
    .stat.highlight { grid-column: auto; }
    .topbar-inner { padding: 12px; }
    .gt-values { gap: 10px 14px; }
}

/* ---------- Mensajes flash ---------- */
.flash {
    width: calc(100% - 48px);
    max-width: 1392px;
    margin: 14px auto 0;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    border: 1px solid;
}

.flash.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash.error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }

/* ---------- Autenticación ---------- */
.auth-wrap {
    min-height: calc(100vh - 260px);
    display: grid;
    place-items: center;
    padding: 28px 12px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
}

.auth-card.wide { max-width: 460px; }

.auth-logo {
    display: block;
    margin: 0 auto 14px;
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 3px 10px rgba(15, 23, 42, .16));
}

.auth-card h1 {
    margin: 0 0 4px;
    font-size: 19px;
    text-align: center;
}

.auth-sub {
    margin: 0 0 20px;
    text-align: center;
    color: var(--ink-muted);
    font-size: 13px;
}

.auth-card .field { margin-bottom: 12px; }
.auth-card .btn { width: 100%; margin-top: 6px; }

.auth-help {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--ink-muted);
    line-height: 1.45;
}

.auth-foot {
    margin: 18px 0 0;
    text-align: center;
    font-size: 12.5px;
    color: var(--ink-muted);
}

.auth-foot a { color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

.auth-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-line);
    color: var(--danger-ink);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13px;
    margin-bottom: 14px;
}

.auth-error ul { margin: 0; padding-left: 16px; }
.validation-summary-valid { display: none !important; }

.field-error {
    display: block;
    margin: -6px 0 10px;
    font-size: 12px;
    color: var(--danger-ink);
}

.field-error:empty { display: none; }

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 16px;
    font-size: 13px;
    color: var(--ink-soft);
    cursor: pointer;
}

.check input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* ---------- Usuarios ---------- */
.users-card { padding: 0 0 6px; }

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.users-table th {
    text-align: left;
    font-size: 11px;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--ink-muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
    white-space: nowrap;
}

.users-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.users-table tbody tr:last-child td { border-bottom: 0; }
.users-table tbody tr:hover td { background: #f8fafc; }

.state {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}

.state.on { background: #dcfce7; color: #166534; }
.state.off { background: #fee2e2; color: #991b1b; }

.tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    background: #e2e8f0;
    color: #475569;
}

.tag.warn { background: #fef3c7; color: #92400e; }

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.row-actions form { margin: 0; }

.btn.sm {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 8px;
}

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

.btn.danger:hover {
    background: var(--danger-bg);
    border-color: #fca5a5;
}

.actions-col { white-space: nowrap; }

@media (max-width: 760px) {
    .users-table thead { display: none; }
    .users-table, .users-table tbody, .users-table tr, .users-table td { display: block; width: 100%; }
    .users-table tr {
        border-bottom: 1px solid var(--line);
        padding: 10px 14px;
    }
    .users-table td { border: 0; padding: 3px 0; }
    .users-table td::before {
        content: attr(data-label);
        display: inline-block;
        min-width: 108px;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: .5px;
        text-transform: uppercase;
        color: var(--ink-muted);
    }
    .users-table td.actions-col { padding-top: 10px; }
    .users-table td.actions-col::before { display: block; margin-bottom: 6px; }
    .auth-card { padding: 24px 18px; }
    .flash { width: calc(100% - 24px); }
}

/* ---------- Configuración de conectores ---------- */
.config-card { padding-bottom: 18px; }

.db-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 20px 0;
}

.db-tab {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}

.db-tab:hover {
    background: #f8fafc;
    border-color: var(--accent);
    color: var(--accent-dark);
}

.db-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.config-form { padding: 16px 20px 0; }

.config-table .num-col { width: 140px; }

.config-table input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.config-table td:first-child input { max-width: 110px; }

.config-table input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}

.config-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 14px;
}

.config-reset {
    margin: 18px 20px 0;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}

.config-help {
    margin: 14px 20px 0;
    font-size: 12px;
    color: var(--ink-muted);
    line-height: 1.5;
}

.config-help code {
    background: #f1f5f9;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 11.5px;
}

@media (max-width: 760px) {
    .db-tabs { padding: 14px 14px 0; }
    .config-form { padding: 14px 14px 0; }
    .config-table td:first-child input { max-width: none; }
    .config-reset { margin: 16px 14px 0; }
    .config-help { margin: 12px 14px 0; }
}

/* ---------- Impresión ---------- */
@media print {
    body { background: #fff; font-size: 10px; }
    .no-print { display: none !important; }
    .page { max-width: none; padding: 0; }
    .card { border: none; box-shadow: none; border-radius: 0; }
    table.report { min-width: 0; }
    table.report thead th { position: static; background: #fff; }
    table.report th,
    table.report td { padding: 5px 7px; }
    tr { page-break-inside: avoid; }
    tbody.day { page-break-inside: auto; }
    .day-row td { background: #f1f5f9; }
    .grand-total { background: #fff; color: #000; border-top: 2px solid #000; }
    .gt-values strong { color: #000; }
    @page { margin: 12mm; }
}
