:root {
    color-scheme: light;
    --brand: #8c0a19;
    --brand-strong: #6f0713;
    --ink: #171b20;
    --muted: #6f7782;
    --line: #dfe4ea;
    --surface: #ffffff;
    --surface-soft: #f7f8fa;
    --page: #edf0f3;
    --success: #08733a;
    --danger: #b42318;
    --focus: #1d6fd6;
    --shadow: 0 10px 28px rgba(23, 27, 32, 0.08);
    --card-border: #dfe4ea;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    min-height: 100%;
    background: var(--page);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    min-height: 100%;
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--page);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body.dialog-open {
    overflow: hidden;
}

body.dialog-keyboard-open .dialog-overlay {
    align-items: start;
    padding-top: calc(8px + env(safe-area-inset-top));
}

body.dialog-keyboard-open .fancy-dialog {
    max-height: calc(100dvh - 18px - env(safe-area-inset-top));
}

body.install-required {
    overflow: hidden;
}

body.install-required .app-shell {
    pointer-events: none;
    user-select: none;
}

body.auth-required {
    overflow: hidden;
}

body.auth-checking .login-screen,
body.auth-checking .app-shell {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

body.login-keyboard-open .login-screen {
    align-items: start;
    padding-top: calc(8px + env(safe-area-inset-top));
}

body.login-keyboard-open .login-card {
    margin: 0;
}

body.login-keyboard-open .login-brand {
    min-height: 64px;
    padding-top: 4px;
    padding-bottom: 8px;
    margin-bottom: 2px;
}

body.login-keyboard-open .login-brand img {
    max-height: 52px;
}

body.login-keyboard-open .login-title {
    margin-bottom: 12px;
    padding-bottom: 8px;
}

body.beneficiarios-mode,
body.visitados-mode,
body.transportes-mode,
body.consulta-mode,
body.consulta-mode .app-shell,
body.beneficiarios-mode .app-shell,
body.visitados-mode .app-shell,
body.transportes-mode .app-shell {
    height: 100dvh;
    overflow: hidden;
}

body.consulta-mode .app-shell,
body.beneficiarios-mode .app-shell,
body.visitados-mode .app-shell,
body.transportes-mode .app-shell {
    display: flex;
    flex-direction: column;
}

body.consulta-mode .mobile-appbar,
body.beneficiarios-mode .mobile-appbar,
body.visitados-mode .mobile-appbar,
body.transportes-mode .mobile-appbar {
    flex: 0 0 auto;
}

body.consulta-mode .app-content,
body.beneficiarios-mode .app-content,
body.visitados-mode .app-content,
body.transportes-mode .app-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.consulta-mode #consulta.active {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

body.consulta-mode.has-affiliate #consulta.active {
    gap: 8px;
}

body.consulta-mode.has-affiliate .affiliate-card {
    flex: 1 1 0;
    min-height: 0;
    height: 0;
    overflow-y: auto;
    padding: 12px 12px calc(124px + env(safe-area-inset-bottom));
    scroll-padding-bottom: calc(124px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

body.ios-device.consulta-mode.has-affiliate .affiliate-card {
    padding-bottom: calc(148px + env(safe-area-inset-bottom));
    scroll-padding-bottom: calc(148px + env(safe-area-inset-bottom));
}

body.consulta-mode.has-affiliate .affiliate-card::-webkit-scrollbar {
    display: none;
}

body.consulta-mode.has-affiliate .search-panel {
    flex: 0 0 auto;
    padding: 10px 18px;
    min-height: auto;
}

body.consulta-mode.has-affiliate .search-panel .section-heading,
body.consulta-mode.has-affiliate #searchStatus.success {
    display: none;
}

body.consulta-mode.has-affiliate .search-input-wrap,
body.consulta-mode.has-affiliate .search-row .search-action {
    height: 56px;
    min-height: 56px;
}

body.consulta-mode.has-affiliate .search-input-wrap {
    grid-template-columns: 40px minmax(0, 1fr);
}

body.consulta-mode.has-affiliate .search-input-icon {
    width: 40px;
}

body.consulta-mode.has-affiliate .search-input-icon svg {
    width: 19px;
    height: 19px;
}

body.consulta-mode.has-affiliate .search-row input {
    height: 44px;
    min-height: 44px;
    line-height: 44px;
}

button,
input {
    font: inherit;
}

button,
.link-button {
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

input {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
    color: var(--ink);
    font-size: 17px;
    -webkit-user-select: text;
    user-select: text;
}

select,
textarea {
    width: 100%;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 17px;
    -webkit-user-select: text;
    user-select: text;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

input:focus {
    outline: 3px solid color-mix(in srgb, var(--brand), transparent 78%);
    outline-offset: 2px;
}

select:focus,
textarea:focus {
    outline: 3px solid color-mix(in srgb, var(--brand), transparent 78%);
    outline-offset: 2px;
}

button:focus,
.link-button:focus {
    outline: 0;
}

.app-shell {
    width: 100%;
    max-width: 540px;
    min-height: 100vh;
    margin: 0 auto;
    background: var(--page);
    position: relative;
}

.app-content {
    position: relative;
    isolation: isolate;
    background: var(--page);
}

.app-content::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: url("app-background.jpg") center 118px / 98% auto no-repeat;
    opacity: 0.32;
    pointer-events: none;
}

.app-content > * {
    position: relative;
    z-index: 1;
}

.mobile-appbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: block;
    padding: calc(9px + env(safe-area-inset-top)) 12px 9px;
    background: #fff;
    color: var(--ink);
    border-bottom: 1px solid rgba(23, 27, 32, 0.08);
    box-shadow: 0 8px 22px rgba(23, 27, 32, 0.12);
}

body.ios-device .mobile-appbar {
    min-height: calc(74px + env(safe-area-inset-top));
}

body.ios-device .header-logo {
    max-height: 68px;
}

body.ios-device .appbar-brand {
    padding-right: 62px;
}

.mobile-appbar h1,
.section-heading h2,
.person-head h2,
.list-toolbar h2,
.beneficiary-main h3 {
    margin: 0;
    line-height: 1.15;
}

.mobile-appbar h1 {
    font-size: 23px;
}

.appbar-brand {
    width: 100%;
    min-width: 0;
    padding-right: 78px;
}

.header-logo {
    display: block;
    width: 100%;
    max-height: 76px;
    object-fit: contain;
    object-position: center;
    background: #fff;
    border-radius: 0;
}

.app-kicker,
.eyebrow,
.mini-label {
    margin: 0 0 5px;
    font-size: 11px;
    letter-spacing: 0;
    text-transform: uppercase;
    font-weight: 900;
}

.app-kicker {
    color: #ffdce1;
}

.sync-pill {
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 900;
}

.appbar-actions {
    position: absolute;
    top: calc(8px + env(safe-area-inset-top));
    right: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 30;
}

.install-gate {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
    background:
        linear-gradient(rgba(237, 240, 243, 0.6), rgba(237, 240, 243, 0.86)),
        url("app-background.jpg") center bottom / min(100%, 540px) auto no-repeat,
        var(--page);
}

.install-gate-card {
    width: min(100%, 420px);
    padding: 22px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 48px rgba(23, 27, 32, 0.18);
    text-align: center;
}

.install-gate-icon {
    width: 86px;
    height: 86px;
    border-radius: 22px;
    object-fit: cover;
    margin-bottom: 14px;
}

.install-gate-card h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.15;
}

.install-gate-message {
    margin: 10px 0 16px;
    color: var(--muted);
    font-weight: 800;
    line-height: 1.35;
}

.install-gate-action {
    width: 100%;
    margin-top: 0;
}

.install-button {
    min-height: 36px;
    border: 1px solid var(--brand);
    border-radius: 999px;
    padding: 0 10px;
    background: var(--brand);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.login-screen {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    align-items: start;
    justify-items: center;
    padding: calc(16px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--page);
}

body.ios-device .login-screen {
    min-height: 100svh;
}

.login-card {
    width: min(100%, 420px);
    margin: auto 0;
    padding: 18px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 48px rgba(23, 27, 32, 0.18);
}

body.ios-device .login-card {
    margin: auto 0;
}

.login-brand {
    display: grid;
    place-items: center;
    min-height: 88px;
    padding: 10px 8px 16px;
    background: transparent;
    border: 0;
    border-radius: 0;
    margin-bottom: 6px;
}

.login-brand img {
    display: block;
    width: 100%;
    max-height: 72px;
    object-fit: contain;
}

body.ios-device .login-brand {
    min-height: 78px;
    padding-top: 8px;
    padding-bottom: 12px;
}

body.ios-device.login-keyboard-open .login-brand {
    min-height: 64px;
    padding-top: 4px;
    padding-bottom: 8px;
    margin-bottom: 2px;
}

body.ios-device.login-keyboard-open .login-brand img {
    max-height: 52px;
}

.login-secret {
    -webkit-text-security: disc;
}

.login-title {
    position: relative;
    margin: 4px 0 22px;
    padding-bottom: 12px;
    text-align: center;
    color: var(--brand);
    font-size: 12px;
}

.login-title::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 64px;
    height: 2px;
    border-radius: 999px;
    background: var(--card-border);
    transform: translateX(-50%);
}

.login-fields {
    display: grid;
    gap: 8px;
}

.login-fields label {
    margin-top: 2px;
    font-weight: 900;
    font-size: 13px;
}

.login-action {
    margin-top: 22px;
}

.user-badge {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 3px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 6px 18px rgba(23, 27, 32, 0.12);
    color: var(--ink);
    overflow: hidden;
}

.user-badge img {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    object-fit: cover;
}

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 224px;
    padding: 10px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 42px rgba(23, 27, 32, 0.18);
}

.user-menu-head {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
}

.user-menu-head img {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    object-fit: cover;
}

.user-menu-head strong,
.user-menu-head span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-head strong {
    color: var(--ink);
    font-size: 15px;
    font-weight: 900;
}

.user-menu-head span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.logout-menu-button {
    width: 100%;
    min-height: 40px;
    margin-top: 10px;
    background: var(--brand);
    color: #fff;
    font-size: 13px;
}


.install-steps {
    margin: 12px 0 0;
    padding-left: 20px;
    color: var(--ink);
    font-weight: 800;
    line-height: 1.45;
}

.install-steps li + li {
    margin-top: 8px;
}

.app-content {
    min-height: calc(100vh - 96px);
    padding: 14px 12px calc(92px + env(safe-area-inset-bottom));
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: grid;
    gap: 12px;
}

#beneficiarios.active,
#visitados.active,
#transportes.active {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
}

.mobile-card,
.summary-row,
.beneficiary-card,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(23, 27, 32, 0.03);
}

.mobile-card {
    padding: 18px;
}

.mobile-subcard {
    margin-top: 12px;
    padding: 14px;
    border-radius: 8px;
    background: var(--surface-soft);
    border: 1px solid var(--card-border);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-heading h2,
.list-toolbar h2 {
    font-size: 21px;
}

.search-panel label,
.support-panel label {
    display: block;
    margin-bottom: 8px;
    font-weight: 900;
}

.search-panel .section-heading {
    margin-bottom: -2px;
}

.search-panel,
#beneficiarios .list-toolbar,
#visitados .list-toolbar {
    display: grid;
    gap: 10px;
    padding: 18px;
    min-height: 122px;
}

.search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 108px;
    gap: 10px;
    align-items: stretch;
}

.search-input-wrap {
    min-width: 0;
    height: 56px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #fbfcfd;
    box-shadow: inset 0 1px 0 rgba(23, 27, 32, 0.03);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search-input-wrap:focus-within {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(140, 10, 25, 0.08);
}

.search-input-icon {
    width: 46px;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--brand);
}

.search-input-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.search-row input {
    height: 54px;
    min-height: 54px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 0;
    line-height: 54px;
    box-shadow: none;
}

.search-input-wrap input:focus,
.search-row input:focus {
    outline: 0;
}

.primary-action {
    width: 100%;
    margin-top: 12px;
    background: var(--brand);
    color: #fff;
}

.search-row .search-action,
.beneficiary-search-row .search-action {
    width: auto;
    min-width: 0;
    height: 56px;
    min-height: 56px;
    margin-top: 0;
    padding: 0 16px;
    font-size: 13px;
    line-height: 1;
    box-shadow: none;
}

.primary-action:hover {
    background: var(--brand-strong);
}

.danger-action {
    background: var(--danger) !important;
}

.danger-action:hover {
    background: #8f1b12 !important;
}

.secondary-action {
    background: #222b35;
    color: #fff;
}

.secondary-action:hover {
    background: #131920;
}

.secondary-action.compact {
    min-height: 42px;
    padding: 0 12px;
}

.whatsapp-action {
    width: 100%;
    margin-top: 0;
    background: #128c3a;
    color: #fff;
}

.whatsapp-action:hover {
    background: #0d7430;
}

.status {
    min-height: 22px;
    margin: 12px 0 0;
    color: var(--brand);
    font-weight: 800;
}

.status:empty {
    display: none;
}

.status.muted {
    color: var(--muted);
    font-weight: 700;
}

.support-panel .status.muted {
    display: none;
}

.status.success {
    color: var(--success);
}

.status.error {
    color: var(--danger);
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.person-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.person-head h2 {
    font-size: 19px;
    line-height: 1.14;
    word-break: break-word;
}

.cedula-chip {
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    padding: 6px 9px;
    font-size: 13px;
    font-weight: 900;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 0;
}

.info-grid div,
.field-block {
    min-width: 0;
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 9px 10px;
}

.info-grid span,
.field-block span,
.beneficiary-meta span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.info-grid strong,
.field-block strong,
.beneficiary-meta strong {
    display: block;
    margin-top: 3px;
    word-break: break-word;
}

.info-grid strong,
.field-block strong {
    font-size: 16px;
    line-height: 1.18;
}

.support-panel .eyebrow {
    color: var(--brand);
    margin-bottom: 12px;
}

body.consulta-mode.has-affiliate .affiliate-card {
    padding-top: 12px;
    padding-right: 12px;
    padding-left: 12px;
}

body.consulta-mode.has-affiliate .person-head {
    align-items: center;
    padding-bottom: 8px;
}

body.consulta-mode.has-affiliate .person-head h2 {
    font-size: 18px;
    line-height: 1.08;
}

body.consulta-mode.has-affiliate .info-grid {
    gap: 7px;
    padding: 8px 0;
}

body.consulta-mode.has-affiliate .info-grid div,
body.consulta-mode.has-affiliate .field-block {
    padding: 7px 9px;
}

body.consulta-mode.has-affiliate .info-grid strong,
body.consulta-mode.has-affiliate .field-block strong {
    font-size: 15px;
    line-height: 1.12;
}

body.consulta-mode.has-affiliate .field-block strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.consulta-mode.has-affiliate .mobile-subcard {
    margin-top: 8px;
    padding: 10px;
}

body.consulta-mode.has-affiliate .support-panel .eyebrow {
    margin-bottom: 8px;
}

body.consulta-mode.has-affiliate .action-stack {
    gap: 7px;
    margin-top: 7px;
}

body.consulta-mode.has-affiliate .action-stack button {
    min-height: 44px;
}

.action-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
}

.action-stack .primary-action {
    margin-top: 0;
}

.record-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.record-action-grid button {
    min-height: 46px;
    margin-top: 0;
    white-space: normal;
    line-height: 1.1;
}

.list-toolbar {
    display: grid;
    gap: 10px;
}

.list-toolbar .eyebrow {
    margin-bottom: -2px;
}

.beneficiary-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 108px;
    gap: 10px;
    align-items: stretch;
}

.beneficiary-fixed {
    display: grid;
    gap: 8px;
    flex: 0 0 auto;
}

#beneficiarios .beneficiary-search-row input {
    height: 54px;
    min-height: 54px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    line-height: 54px;
    box-shadow: none;
}

#visitados .beneficiary-search-row input {
    height: 54px;
    min-height: 54px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    line-height: 54px;
    box-shadow: none;
}

#beneficiarios .beneficiary-search-row button,
#visitados .beneficiary-search-row button {
    margin-top: 0;
    font-size: 13px;
}

.summary-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
}

.summary-row span {
    color: var(--muted);
    font-weight: 800;
}

.summary-row strong {
    color: var(--brand);
    font-size: 15px;
}

.beneficiary-cards {
    display: grid;
    gap: 10px;
    align-content: start;
    grid-auto-rows: max-content;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1px 1px 5px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.beneficiary-cards::-webkit-scrollbar {
    display: none;
}

.transport-fixed {
    display: grid;
    gap: 8px;
    flex: 0 0 auto;
}

.transport-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.transport-actions .search-action {
    min-height: 48px;
    margin-top: 0;
    padding: 0 12px;
    font-size: 13px;
    line-height: 1.15;
}

.transport-cards {
    display: grid;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
    padding: 1px 1px 5px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.transport-cards::-webkit-scrollbar {
    display: none;
}

.transport-group-title {
    margin: 8px 4px 0;
    color: var(--brand);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.transport-card {
    padding: 14px;
    border-radius: 12px;
}

.transport-card-head,
.transport-card-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.transport-card h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.2;
}

.transport-card p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.transport-status {
    color: var(--success);
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

.transport-status.inactive {
    color: var(--muted);
}

.transport-card .row-actions {
    margin-top: 12px;
    padding: 0;
}

.transport-expense {
    padding: 14px;
    border-radius: 12px;
}

.transport-expense strong {
    color: var(--brand);
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.transport-expense .transport-card-line + .transport-card-line {
    margin-top: 6px;
}

.transport-expense .transport-card-line:first-child span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.transport-expense .transport-card-line:nth-child(2) {
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.transport-expense .transport-card-line:nth-child(2) span:last-child {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-align: right;
}

.transport-expense .row-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.export-bottom {
    width: 100%;
    flex: 0 0 auto;
    margin-bottom: calc(84px + env(safe-area-inset-bottom));
}

#beneficiarios.active .export-bottom,
#visitados.active .export-bottom {
    align-self: end;
    margin-top: 0;
}

.beneficiary-card {
    align-self: start;
    overflow: hidden;
    background: #fff;
}

.beneficiary-main {
    padding: 10px 12px 9px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.beneficiary-title {
    min-width: 0;
}

.beneficiary-main h3 {
    font-size: 15px;
    line-height: 1.2;
    word-break: break-word;
}

.beneficiary-user {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.mini-label {
    color: var(--muted);
}

.beneficiary-meta {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
}

.beneficiary-meta div {
    min-width: 0;
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 8px;
}

.beneficiary-meta .meta-cedula,
.beneficiary-meta .meta-talon,
.beneficiary-meta .meta-boleta {
    grid-column: span 2;
}

.beneficiary-meta .meta-fecha,
.beneficiary-meta .meta-monto {
    grid-column: span 3;
}

.beneficiary-meta .meta-wide {
    grid-column: span 6;
}

.beneficiary-meta span {
    font-size: 9px;
    line-height: 1.1;
}

.beneficiary-meta strong {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.15;
}

.meta-action-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.beneficiary-meta .meta-action-line {
    border-radius: 0;
    background: transparent;
    padding: 0;
}

.meta-action-line strong {
    min-width: 0;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.meta-action-buttons {
    display: inline-flex;
    gap: 6px;
    justify-content: flex-end;
    white-space: nowrap;
    text-transform: none;
}

.meta-chip-action {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 0 9px;
    background: #fff;
    color: var(--ink);
    font-size: 11px;
    font-weight: 900;
    text-decoration: none;
    text-transform: none;
}

.beneficiary-meta .meta-fecha strong {
    font-size: 12px;
    white-space: nowrap;
}

.beneficiary-meta .meta-monto strong {
    color: var(--brand);
    font-weight: 900;
    white-space: nowrap;
}

.visit-meta .meta-monto strong {
    color: var(--ink);
}

.row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 8px 8px;
}

.row-actions .ghost {
    min-height: 36px;
    font-size: 13px;
}

.button-icon {
    width: 17px;
    height: 17px;
    margin-right: 6px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ghost {
    min-height: 44px;
    background: #eef1f4;
    color: var(--ink);
}

.ghost:hover {
    background: #dde3e9;
}

.danger {
    color: var(--danger);
}

.empty-state {
    margin: 0;
    padding: 18px;
    color: var(--muted);
    font-weight: 800;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 30;
    width: min(620px, calc(100% - 24px));
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 7px;
    margin-bottom: calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    box-shadow: 0 16px 38px rgba(23, 27, 32, 0.16);
    backdrop-filter: blur(16px);
}

.dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    align-items: center;
    justify-items: center;
    padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
    background: rgba(12, 16, 20, 0.48);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.dialog-overlay.visit-dialog-overlay {
    align-items: start;
    padding-top: calc(12px + env(safe-area-inset-top));
}

.dialog-overlay.visit-dialog-overlay .fancy-dialog {
    max-height: calc(100dvh - 26px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

.fancy-dialog {
    width: min(100%, 500px);
    max-height: min(82dvh, 560px);
    overflow-y: auto;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    padding: 14px;
    -webkit-overflow-scrolling: touch;
}

.fancy-dialog h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
}

.dialog-message {
    margin: 7px 0 0;
    color: var(--muted);
    font-weight: 700;
    line-height: 1.35;
}

.dialog-record-meta {
    display: grid;
    gap: 3px;
    margin-top: 9px;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.35;
}

.dialog-fields {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.dialog-fields label {
    font-weight: 900;
    font-size: 14px;
}

.dialog-fields input,
.dialog-fields select,
.dialog-fields textarea {
    min-height: 46px;
    font-size: 16px;
    padding: 10px 12px;
}

.dialog-fields input:disabled,
.dialog-fields select:disabled,
.dialog-fields textarea:disabled {
    color: var(--ink);
    background: #f1f3f6;
    opacity: 1;
    font-weight: 800;
}

.dialog-fields textarea {
    min-height: 74px;
}

.uppercase-field {
    text-transform: uppercase;
}

.location-capture-field {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: stretch;
}

.location-capture-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 8px;
    align-items: stretch;
}

.location-capture-field input {
    min-width: 0;
    cursor: default;
    caret-color: transparent;
}

.location-capture-field input:focus {
    border-color: var(--line);
    box-shadow: none;
    outline: none;
}

.location-capture-button {
    display: flex !important;
    min-height: 46px;
    width: 100%;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 0 14px;
    background: #a7071d;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 900;
    -webkit-appearance: none;
    appearance: none;
}

.location-capture-button svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.location-capture-button.is-loading svg {
    animation: spin 900ms linear infinite;
}

.location-capture-button:disabled {
    opacity: 0.65;
}

.location-status {
    grid-column: 1 / -1;
    min-height: 18px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.phone-field {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 8px;
}

.choice-field {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    max-height: 190px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.compact-choice-field {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
}

.choice-option {
    min-height: 42px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #f5f7f9;
    color: var(--ink);
    font-size: 14px;
    font-weight: 900;
    box-shadow: none;
}

.choice-option.active {
    border-color: var(--brand);
    background: rgba(167, 7, 29, 0.08);
    color: var(--brand);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.location-capture-field.has-error input {
    border-color: var(--danger);
}

.location-capture-field.has-error .location-status {
    color: var(--danger);
}

.location-capture-field.has-success .location-status {
    color: #0f8a3a;
}

.map-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 900;
}

.phone-link {
    color: var(--success);
    text-decoration: none;
    font-weight: 900;
}

.dialog-secret {
    -webkit-text-security: disc;
    text-security: disc;
}

.dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.dialog-actions.single-action {
    grid-template-columns: 1fr;
}

.dialog-actions button,
.dialog-actions a {
    min-height: 44px;
    padding: 0 10px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    text-decoration: none;
}

.dialog-primary {
    margin-top: 0;
}

.tab-button {
    position: relative;
    min-width: 0;
    min-height: 62px;
    display: grid;
    gap: 5px;
    justify-items: center;
    align-content: center;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    line-height: 1.1;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab-button > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab-button.active {
    background: var(--brand);
    color: #fff;
    box-shadow: none;
    transform: translateY(-1px);
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: currentColor;
}

.nav-icon svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tab-button::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 18px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0;
    transform: translateX(-50%) scaleX(0.55);
    transition: opacity 160ms ease, transform 160ms ease;
}

.tab-button.active::after {
    opacity: 0.9;
    transform: translateX(-50%) scaleX(1);
}

@media (min-width: 700px) {
    .app-shell {
        border-left: 1px solid var(--line);
        border-right: 1px solid var(--line);
    }
}

@media (max-width: 380px) {
    .app-content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .mobile-card {
        padding: 14px;
    }

    .mobile-appbar h1 {
        font-size: 20px;
    }

    .person-head h2 {
        font-size: 18px;
    }

    .info-grid strong,
    .field-block strong {
        font-size: 15px;
    }
}

@media print {
    body,
    .app-shell,
    .mobile-card {
        background: #fff;
    }

    .mobile-appbar,
    .bottom-nav,
    .search-panel,
    .support-panel,
    #beneficiarios,
    #transportes {
        display: none !important;
    }

    .app-content {
        padding: 0;
    }
}
