:root {
    --pink: #f01372;
    --pink-2: #ff4f9a;
    --purple: #6823c3;
    --purple-2: #8c43e8;
    --blue: #1297e8;
    --cyan: #41c7f4;
    --orange: #ff9f0f;
    --green: #32bf5b;
    --red: #e94a66;
    --ink: #17213b;
    --ink-soft: #35415f;
    --muted: #74809a;
    --bg: #f5f8ff;
    --surface: #ffffff;
    --surface-soft: #fbfcff;
    --line: #e5eaf4;
    --line-strong: #d7deea;
    --radius: 18px;
    --radius-sm: 12px;
    --sidebar-width: 268px;
    --topbar-height: 66px;
    --shadow-sm: 0 7px 20px rgba(47, 61, 113, 0.06);
    --shadow: 0 12px 30px rgba(47, 61, 113, 0.09);
    --shadow-lg: 0 24px 70px rgba(31, 43, 85, 0.14);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 160ms var(--ease-out);
    --transition: 260ms var(--ease-out);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 85% -10%, rgba(65, 199, 244, 0.10), transparent 28rem),
        var(--bg);
    font-size: 0.94rem;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body.app-body {
    overflow-x: hidden;
}

body.nav-locked,
body.modal-locked,
body.search-locked {
    overflow: hidden;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: var(--purple);
    text-decoration: none;
    transition: color var(--transition-fast), opacity var(--transition-fast);
}

a:hover {
    color: #45158b;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 3px solid rgba(18, 151, 232, 0.26);
    outline-offset: 2px;
}

::selection {
    color: #fff;
    background: var(--purple);
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 4000;
    padding: 10px 14px;
    border-radius: 10px;
    color: #fff;
    background: var(--ink);
    transform: translateY(-180%);
    transition: transform var(--transition);
}

.skip-link:focus {
    color: #fff;
    transform: translateY(0);
}

.text-pink { color: var(--pink) !important; }
.text-purple { color: var(--purple) !important; }
.text-orange { color: var(--orange) !important; }
.text-blue { color: var(--blue) !important; }

/* Layout */
.app-frame {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    overflow-y: auto;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at 15% 0%, rgba(255, 79, 154, 0.06), transparent 15rem),
        linear-gradient(180deg, #fff 0%, #fbfbff 100%);
    border-right: 1px solid #e9eaf1;
    scrollbar-width: thin;
    scrollbar-color: #d8ddea transparent;
}

.sidebar-brand-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 112px;
    padding: 14px 20px 8px;
}

.sidebar-brand {
    display: block;
    text-align: center;
    border-radius: 16px;
}

.sidebar-brand img {
    width: 190px;
    max-width: 100%;
    height: 92px;
    object-fit: contain;
    transition: transform 420ms var(--ease-spring), filter var(--transition);
}

.sidebar-brand:hover img {
    transform: translateY(-2px) scale(1.015);
    filter: drop-shadow(0 9px 15px rgba(104, 35, 195, 0.12));
}

.sidebar-close {
    position: absolute;
    top: 12px;
    right: 12px;
}

.app-nav {
    flex: 1;
    padding: 4px 16px 20px;
}

.app-nav-section {
    padding: 16px 10px 7px;
    font-size: 0.70rem;
    font-weight: 850;
    letter-spacing: 0.075em;
    text-transform: uppercase;
}

.app-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 47px;
    margin: 3px 0;
    padding: 10px 13px;
    overflow: hidden;
    color: #26314b;
    font-size: 0.96rem;
    font-weight: 620;
    border-radius: 14px;
    transition:
        color var(--transition-fast),
        background var(--transition-fast),
        transform var(--transition-fast),
        box-shadow var(--transition-fast);
}

.app-nav-link::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 8px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0;
    transform: translate(8px, -50%);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.app-nav-link:hover {
    color: var(--purple);
    background: #f6f0ff;
    transform: translateX(2px);
}

.app-nav-link:hover::after {
    opacity: 0.28;
    transform: translate(0, -50%);
}

.app-nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--pink), #e92793);
    box-shadow: 0 9px 22px rgba(240, 19, 114, 0.22);
}

.app-nav-link.active::after {
    opacity: 0.72;
    transform: translate(0, -50%);
}

.nav-icon {
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    font-size: 1.28rem;
    font-weight: 800;
    transition: transform var(--transition);
}

.app-nav-link:hover .nav-icon {
    transform: translateY(-1px) scale(1.06);
}

.sidebar-party-card {
    margin: 10px 17px 22px;
    padding: 17px 15px;
    overflow: hidden;
    color: #4c1d87;
    text-align: center;
    font-size: 0.82rem;
    background: linear-gradient(145deg, #eafbff, #fff2b7);
    border-radius: 20px;
    box-shadow: inset 0 0 0 1px rgba(38, 151, 232, 0.08);
}

.sidebar-party-card span,
.sidebar-party-card strong {
    display: block;
}

.sidebar-party-card span {
    margin: 3px;
    color: var(--orange);
    letter-spacing: 0.35em;
}

.app-stage {
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    margin-left: var(--sidebar-width);
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 18px;
    height: var(--topbar-height);
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(229, 234, 244, 0.92);
    backdrop-filter: blur(18px) saturate(1.18);
    -webkit-backdrop-filter: blur(18px) saturate(1.18);
    transition: box-shadow var(--transition), background var(--transition);
}

.app-topbar.is-scrolled {
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 8px 24px rgba(30, 43, 83, 0.07);
}

.topbar-menu {
    flex: 0 0 auto;
    font-size: 1.35rem;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    white-space: nowrap;
}

.crumb {
    max-width: 180px;
    overflow: hidden;
    color: #6e7890;
    text-overflow: ellipsis;
}

.crumb:first-child {
    color: #131d35;
}

.crumb-sep {
    color: #b8bfd0;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 9px;
    width: min(470px, 40vw);
    height: 42px;
    margin-right: auto;
    margin-left: auto;
    padding: 0 13px;
    background: #fff;
    border: 1px solid #dce3f2;
    border-radius: 13px;
    box-shadow: 0 5px 14px rgba(36, 50, 93, 0.05);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.topbar-search:focus-within {
    border-color: #bd9aef;
    box-shadow: 0 9px 24px rgba(104, 35, 195, 0.10), 0 0 0 3px rgba(104, 35, 195, 0.06);
    transform: translateY(-1px);
}

.topbar-search-icon {
    color: var(--purple);
    font-size: 1.2rem;
    line-height: 1;
}

.topbar-search input {
    width: 100%;
    min-width: 0;
    padding: 0;
    color: var(--ink);
    background: transparent;
    border: 0;
    outline: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.icon-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 41px;
    height: 41px;
    flex: 0 0 41px;
    padding: 0;
    color: #0576df;
    background: transparent;
    border: 0;
    border-radius: 12px;
    font-size: 1.22rem;
    line-height: 1;
    transition: color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.icon-button:hover {
    color: #075fae;
    background: #eff7ff;
    transform: translateY(-1px);
}

.icon-button:active {
    transform: translateY(0) scale(0.96);
}

.badge-dot {
    position: absolute;
    top: -1px;
    right: 0;
    display: grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 4px;
    color: #fff;
    background: var(--pink);
    border: 2px solid #fff;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
}

.badge-dot.blue {
    background: var(--blue);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 4px 7px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 13px;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.user-menu:hover {
    background: #f5f7fb;
}

.user-menu:active {
    transform: scale(0.985);
}

.app-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    color: #fff;
    font-weight: 850;
    background: linear-gradient(135deg, var(--purple), #ae64f4);
    border-radius: 50%;
    box-shadow: 0 6px 14px rgba(104, 35, 195, 0.18);
}

.user-copy {
    min-width: 0;
    text-align: left;
    line-height: 1.15;
}

.user-copy strong,
.user-copy small {
    display: block;
}

.user-copy strong {
    max-width: 150px;
    overflow: hidden;
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.68rem;
}

.notification-menu {
    width: min(350px, calc(100vw - 24px));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.dropdown-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 15px;
    font-weight: 750;
    border-bottom: 1px solid var(--line);
}

.dropdown-title a {
    font-size: 0.76rem;
}

.notification-item {
    display: block;
    padding: 12px 15px;
    color: var(--ink);
    border-bottom: 1px solid #f0f2f7;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.notification-item:hover {
    color: var(--ink);
    background: #f8f8ff;
    transform: translateX(2px);
}

.notification-item.unread {
    background: #fff6fb;
}

.notification-item strong,
.notification-item small {
    display: block;
}

.notification-item small {
    margin-top: 3px;
    color: var(--muted);
}

.app-content {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 26px 28px 40px;
}

/* Dashboard hero */
.hero-dashboard {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    min-height: 150px;
    margin: -26px -28px 16px;
    padding: 27px 28px 12px;
    overflow: hidden;
    background:
        radial-gradient(circle at 92% 22%, rgba(65, 199, 244, 0.20), transparent 14rem),
        linear-gradient(120deg, #fff 0%, #f8fbff 53%, #e7f8ff 100%);
    border-bottom: 1px solid #e9eef8;
}

.hero-dashboard::before,
.hero-dashboard::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
}

.hero-dashboard::before {
    top: -90px;
    right: 24%;
    width: 190px;
    height: 190px;
    background: rgba(255, 79, 154, 0.05);
}

.hero-dashboard::after {
    right: 6%;
    bottom: -65px;
    width: 400px;
    height: 150px;
    background: #cfeeff;
    opacity: 0.72;
}

.hero-copy {
    position: relative;
    z-index: 2;
    align-self: center;
    max-width: 760px;
}

.page-eyebrow {
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.09em;
    color: var(--purple);
    text-transform: uppercase;
}

.hero-copy h1 {
    margin: 8px 0;
    color: #401480;
    font-size: clamp(1.8rem, 3vw, 2.65rem);
    font-weight: 850;
    line-height: 1.03;
    letter-spacing: -0.025em;
}

.hero-copy h1 span {
    color: var(--pink);
}

.hero-copy p {
    max-width: 700px;
    margin: 0;
    color: #65718c;
    font-size: clamp(0.92rem, 1.5vw, 1.02rem);
}

.hero-swoosh {
    width: 130px;
    height: 7px;
    margin-top: 10px;
    background: var(--orange);
    border-radius: 50%;
    transform: rotate(-4deg);
    transform-origin: left center;
}

.hero-art {
    position: relative;
    z-index: 2;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 420px;
    margin-right: 2%;
}

.hero-art img {
    width: 205px;
    height: 122px;
    object-fit: contain;
    filter: drop-shadow(0 10px 12px rgba(104, 35, 195, 0.14));
    animation: heroFloat 6s ease-in-out infinite;
}

.hero-art strong {
    color: var(--purple);
    font-size: 1.15rem;
    line-height: 1.05;
    transform: rotate(-4deg);
}

.hero-art em {
    color: var(--pink);
    font-style: normal;
}

.hero-balloons {
    position: absolute;
    bottom: 18px;
    left: 4px;
    display: flex;
    align-items: flex-end;
    gap: 7px;
}

.hero-balloons i {
    display: block;
    width: 33px;
    height: 42px;
    background: var(--blue);
    border-radius: 50%;
    animation: balloonDrift 5.2s ease-in-out infinite;
}

.hero-balloons i:nth-child(2) {
    height: 52px;
    background: var(--orange);
    animation-delay: -1.4s;
}

.hero-balloons i:nth-child(3) {
    height: 36px;
    background: var(--purple);
    animation-delay: -2.6s;
}

/* Cards and metrics */
.metric-grid {
    position: relative;
    z-index: 3;
}

.metric-card,
.mini-finance,
.chq-card,
.card,
.quick-tile,
.order-finance-zone {
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        border-color var(--transition),
        background var(--transition);
}

.metric-card {
    position: relative;
    display: flex;
    gap: 14px;
    height: 154px;
    padding: 17px 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.93);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.metric-card::after {
    content: "";
    position: absolute;
    top: -60px;
    right: -55px;
    width: 130px;
    height: 130px;
    background: currentColor;
    border-radius: 50%;
    opacity: 0.035;
    transform: scale(0.8);
    transition: transform 500ms var(--ease-out), opacity var(--transition);
}

.metric-card:hover {
    border-color: #d9dfee;
    box-shadow: 0 17px 38px rgba(47, 61, 113, 0.12);
    transform: translateY(-3px);
}

.metric-card:hover::after {
    opacity: 0.06;
    transform: scale(1.08);
}

.metric-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 800;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(18, 30, 68, 0.10);
    transition: transform 360ms var(--ease-spring);
}

.metric-card:hover .metric-icon {
    transform: translateY(-2px) rotate(-3deg) scale(1.04);
}

.metric-card.pink .metric-icon { background: linear-gradient(135deg, var(--pink), #ee3398); }
.metric-card.blue .metric-icon { background: linear-gradient(135deg, var(--blue), #087fd0); }
.metric-card.orange .metric-icon { background: linear-gradient(135deg, var(--orange), #ffc029); }
.metric-card.green .metric-icon { background: linear-gradient(135deg, var(--green), #79d139); }

.metric-card > div:nth-child(2) {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.metric-card span {
    font-weight: 750;
}

.metric-card strong {
    display: block;
    max-width: 100%;
    margin: 8px 0 5px;
    overflow: hidden;
    color: #101a32;
    font-size: clamp(1.55rem, 2vw, 2.15rem);
    font-weight: 850;
    line-height: 1.1;
    text-overflow: ellipsis;
}

.metric-card small {
    color: var(--muted);
}

.metric-ghost {
    position: absolute;
    right: 16px;
    bottom: 13px;
    font-size: 3rem;
    font-weight: 900;
    opacity: 0.12;
}

.metric-progress {
    position: absolute;
    right: 18px;
    bottom: 27px;
    width: 90px;
    height: 8px;
    overflow: hidden;
    background: #edf0f5;
    border-radius: 30px;
}

.metric-progress i {
    display: block;
    width: 62%;
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--pink), var(--orange));
    border-radius: 30px;
    animation: progressBreathe 4s ease-in-out infinite;
}

.mini-bars {
    position: absolute;
    right: 20px;
    bottom: 23px;
    display: flex;
    align-items: end;
    gap: 5px;
    height: 56px;
    opacity: 0.45;
}

.mini-bars i {
    width: 10px;
    height: 30%;
    background: #28bc8e;
    border-radius: 3px;
    transform-origin: bottom;
    animation: barPulse 3s ease-in-out infinite;
}

.mini-bars i:nth-child(2) { height: 50%; animation-delay: -0.4s; }
.mini-bars i:nth-child(3) { height: 67%; animation-delay: -0.8s; }
.mini-bars i:nth-child(4) { height: 95%; animation-delay: -1.2s; }

.mini-finance {
    display: block;
    height: 82px;
    padding: 14px 16px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.mini-finance:hover {
    color: var(--ink);
    border-color: #d8deeb;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.mini-finance span,
.mini-finance strong {
    display: block;
}

.mini-finance span {
    color: var(--muted);
    font-size: 0.73rem;
}

.mini-finance strong {
    margin-top: 5px;
    overflow: hidden;
    font-size: 1.15rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-finance.danger strong { color: var(--red); }
.mini-finance.success strong { color: #138a4a; }
.mini-finance.warning strong { color: #db8900; }

.chq-card,
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.chq-card {
    padding: 0;
    overflow: hidden;
}

.chq-card:hover,
.card:hover {
    border-color: #dde3ef;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    min-height: 67px;
    padding: 16px 19px;
    background: linear-gradient(180deg, #fff, #fefeff);
    border-bottom: 1px solid var(--line);
}

.card-title-row > div {
    min-width: 0;
}

.card-title-row h2 {
    margin: 0;
    color: #511c89;
    font-size: 1.13rem;
    font-weight: 820;
}

.card-title-row p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.80rem;
}

.title-icon {
    display: inline-grid;
    place-items: center;
    width: 29px;
    height: 29px;
    margin-right: 7px;
    color: #fff;
    border-radius: 9px;
}

.title-icon.pink { background: var(--pink); }
.title-icon.orange { background: var(--orange); }

.btn-soft-purple {
    color: var(--purple);
    background: #faf7ff;
    border: 1px solid #d7c5f7;
    border-radius: 12px;
}

.btn-soft-purple:hover {
    color: #4b158e;
    background: #f1e8ff;
}

/* Tables */
.table-responsive {
    position: relative;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: #cbd3e2 transparent;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd3e2;
    border-radius: 999px;
}

.app-table {
    --bs-table-bg: transparent;
    margin: 0;
}

.app-table thead th {
    padding: 11px 15px;
    color: #6e7890;
    background: #f7f9fd;
    border-bottom-color: var(--line);
    font-size: 0.70rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-table td {
    padding: 12px 15px;
    color: var(--ink-soft);
    border-color: #eef1f7;
    vertical-align: middle;
}

.app-table tbody tr {
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.app-table tbody tr:hover {
    background: #fbfcff;
}

.row-color {
    display: inline-block;
    width: 5px;
    height: 28px;
    margin-right: 9px;
    vertical-align: middle;
    border-radius: 4px;
}

.row-color.c0 { background: var(--pink); }
.row-color.c1 { background: var(--blue); }
.row-color.c2 { background: var(--orange); }
.row-color.c3 { background: var(--green); }
.row-color.c4 { background: var(--purple); }

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 29px;
    padding: 5px 10px;
    color: #3177bf;
    background: #edf3ff;
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 750;
    line-height: 1.15;
    text-transform: capitalize;
    white-space: nowrap;
}

.state-confirmada,
.state-finalizada {
    color: #1e8a4b;
    background: #e7f8ed;
}

.state-en_curso {
    color: #a96900;
    background: #fff3d8;
}

.state-borrador,
.state-pendiente_aprobacion,
.state-pendiente_abono {
    color: #6a5a1b;
    background: #fff8db;
}

.state-reservada,
.state-programada,
.state-despachada {
    color: #315aa5;
    background: #eaf1ff;
}

.state-finalizada_operativa,
.state-pendiente_cierre_financiero {
    color: #6c41a6;
    background: #f1eaff;
}

.state-reprogramada {
    color: #9a5b16;
    background: #fff0df;
}

.state-disputada,
.state-reembolsada {
    color: #9d3151;
    background: #ffeaf1;
}

.state-cancelada {
    color: #b52d4e;
    background: #ffe9ee;
}

.table-action {
    font-size: 0.78rem;
    font-weight: 750;
}

/* Notifications and quick actions */
.notification-list {
    padding: 5px 14px 14px;
}

.dash-notification {
    display: flex;
    gap: 10px;
    padding: 12px 7px;
    color: var(--ink);
    border-bottom: 1px solid #f0f2f7;
    border-radius: 10px;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.dash-notification:hover {
    color: var(--ink);
    background: #faf8ff;
    transform: translateX(2px);
}

.dash-notification.unread {
    background: #fff9fc;
}

.notif-bullet {
    width: 11px;
    height: 11px;
    flex: 0 0 11px;
    margin-top: 4px;
    background: var(--pink);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(240, 19, 114, 0.08);
}

.dash-notification strong,
.dash-notification small {
    display: block;
}

.dash-notification small {
    margin-top: 2px;
    color: var(--muted);
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    gap: 12px;
    padding: 13px 18px 20px;
}

.quick-tile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 92px;
    padding: 13px;
    color: #293149;
    border: 1px solid transparent;
    border-radius: 13px;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.quick-tile span { font-size: 1.25rem; }
.quick-tile strong { min-width: 0; line-height: 1.2; }
.quick-tile b { font-size: 1.5rem; transition: transform var(--transition-fast); }
.quick-tile.pink { color: #dc145f; background: #fff0f6; }
.quick-tile.blue { color: #0783d5; background: #eaf7ff; }
.quick-tile.orange { color: #b86b00; background: #fff4de; }
.quick-tile.green { color: #2d9238; background: #edf9ed; }
.quick-tile.purple { color: #6b28c1; background: #f2ebff; }

.quick-tile:hover {
    color: currentColor;
    border-color: rgba(104, 35, 195, 0.08);
    box-shadow: 0 12px 25px rgba(41, 49, 73, 0.08);
    filter: saturate(1.05);
    transform: translateY(-3px);
}

.quick-tile:hover b {
    transform: translateX(3px);
}

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

/* Page headers, forms and controls */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
}

.page-header > div {
    min-width: 0;
}

.page-header h1 {
    margin: 0;
    font-size: clamp(1.45rem, 2vw, 1.7rem);
    font-weight: 840;
    letter-spacing: -0.018em;
}

.page-header p {
    margin: 5px 0 0;
    color: var(--muted);
}

.filter-card {
    margin-bottom: 16px;
    padding: 14px;
}

.form-control,
.form-select {
    min-height: 42px;
    color: var(--ink);
    background-color: #fff;
    border-color: #dfe4ee;
    border-radius: 11px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

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

.form-control:hover,
.form-select:hover {
    border-color: #cfd6e4;
}

.form-control:focus,
.form-select:focus {
    border-color: #be96f4;
    box-shadow: 0 0 0 0.2rem rgba(104, 35, 195, 0.09);
}

.form-control::placeholder {
    color: #9ba6b8;
}

.form-label,
.card label:not(.form-check-label) {
    color: #47516a;
    font-size: 0.82rem;
    font-weight: 720;
}

.form-check.form-switch .form-check-input {
    width: 2.6em;
    height: 1.35em;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--pink);
    border-color: var(--pink);
}

.btn {
    position: relative;
    overflow: hidden;
    border-radius: 11px;
    font-weight: 680;
    transition:
        color var(--transition-fast),
        background var(--transition-fast),
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        transform var(--transition-fast);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0) scale(0.985);
}

.btn:disabled {
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--pink), #e52c94);
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(240, 19, 114, 0.14);
}

.btn-primary:hover,
.btn-primary:focus {
    color: #fff;
    background: linear-gradient(135deg, #d30b61, #c81e82);
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(211, 11, 97, 0.20);
}

.btn-success {
    background: #20a95b;
    border-color: #20a95b;
}

.btn-outline-primary {
    color: var(--purple);
    border-color: #b795ed;
}

.btn-outline-primary:hover {
    color: #fff;
    background: var(--purple);
    border-color: var(--purple);
}

.pagination {
    flex-wrap: wrap;
    gap: 3px;
}

.pagination .page-link {
    color: var(--purple);
    border-color: #e1e5ee;
    border-radius: 9px !important;
}

.pagination .page-item.active .page-link {
    color: #fff;
    background: var(--purple);
    border-color: var(--purple);
}

.pagination-summary {
    color: var(--muted);
    font-size: 0.8rem;
}

.detail-row {
    padding: 10px 0;
    border-bottom: 1px dashed #e9edf4;
}

.detail-row:last-child {
    border-bottom: 0;
}

.detail-row.is-new {
    animation: detailIn 320ms var(--ease-out) both;
}

/* Finance */
.tabs-finance {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 18px 0;
}

.tabs-finance a {
    padding: 9px 12px;
    color: #536078;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 11px;
    transition: all var(--transition-fast);
}

.tabs-finance a:hover {
    color: var(--purple);
    border-color: #cdb8ef;
    transform: translateY(-1px);
}

.tabs-finance a.active {
    color: #fff;
    background: var(--purple);
    border-color: var(--purple);
    box-shadow: 0 7px 16px rgba(104, 35, 195, 0.18);
}

.finance-summary-card {
    min-height: 116px;
    padding: 18px;
}

.finance-summary-card:hover {
    box-shadow: 0 15px 35px rgba(47, 61, 113, 0.11);
    transform: translateY(-2px);
}

.finance-summary-card span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
}

.finance-summary-card strong {
    display: block;
    margin-top: 6px;
    font-size: clamp(1.2rem, 2.2vw, 1.55rem);
    overflow-wrap: anywhere;
}

.evidence-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 31px;
    padding: 5px 9px;
    background: #eff8ff;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.verification-pending { color: #a86d00; background: #fff4da; }
.verification-verificado { color: #168345; background: #e8f8ed; }
.verification-rechazado,
.verification-anulado { color: #b23a4d; background: #ffe9ee; }

.verification-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.70rem;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
}

.order-finance-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.order-finance-zone {
    min-width: 0;
    padding: 15px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.order-finance-zone:hover {
    border-color: #d9e0ec;
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.order-finance-zone h3 {
    color: var(--purple);
    font-size: 1rem;
}

.finance-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed #e6e9ef;
}

.finance-line > * {
    min-width: 0;
}

.finance-line:last-child {
    border-bottom: 0;
}

.finance-line.total {
    color: #18203a;
    font-weight: 800;
}

/* Toasts and modal */
.app-toast-container {
    position: fixed;
    top: calc(var(--topbar-height) + 14px);
    right: 18px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 9px;
    width: min(380px, calc(100vw - 24px));
    pointer-events: none;
}

.app-toast {
    padding: 13px 15px;
    background: #fff;
    border: 1px solid rgba(229, 234, 244, 0.9);
    border-left: 5px solid var(--blue);
    border-radius: 14px;
    box-shadow: 0 15px 35px rgba(24, 35, 66, 0.18);
    animation: toastIn 280ms var(--ease-out) both;
    pointer-events: auto;
}

.app-toast.is-leaving {
    animation: toastOut 220ms var(--ease-out) both;
}

.app-toast.success { border-left-color: var(--green); }
.app-toast.error { border-left-color: var(--red); }

.app-toast strong,
.app-toast span {
    display: block;
}

.app-toast span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.82rem;
}

.app-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(18, 25, 45, 0.48);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: backdropIn 180ms ease both;
}

.app-modal-backdrop[hidden] {
    display: none !important;
}

.app-modal {
    position: relative;
    width: min(430px, 100%);
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    padding: 24px;
    text-align: center;
    background: #fff;
    border: 1px solid rgba(229, 234, 244, 0.95);
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(13, 22, 47, 0.28);
    animation: modalIn 280ms var(--ease-spring) both;
}

.modal-x {
    position: absolute;
    top: 10px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    padding: 0;
    background: #f2f4f8;
    border: 0;
    border-radius: 50%;
}

.modal-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    color: var(--pink);
    background: #fff0f4;
    border-radius: 50%;
    font-size: 1.8rem;
    font-weight: 800;
}

.app-modal h3 {
    font-size: 1.2rem;
}

.app-modal p {
    color: var(--muted);
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 9px;
    margin-top: 17px;
}

/* Auth */
.auth-shell {
    position: relative;
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 28px;
    overflow: hidden;
    background:
        radial-gradient(circle at 10% 0%, rgba(255, 79, 154, 0.14), transparent 25rem),
        radial-gradient(circle at 92% 90%, rgba(65, 199, 244, 0.16), transparent 28rem),
        #f5f8ff;
}

.auth-card {
    position: relative;
    width: min(470px, 100%);
    padding: 28px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(56, 43, 91, 0.13);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: authIn 460ms var(--ease-out) both;
}

.auth-logo {
    display: block;
    width: 220px;
    height: 120px;
    margin: 0 auto 12px;
    object-fit: contain;
}

.auth-card h1 {
    color: #501384;
    font-size: 1.55rem;
    font-weight: 850;
    text-align: center;
}

.auth-card .lead {
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.lock-avatar {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    color: #fff;
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    border-radius: 50%;
}

.profile-card {
    padding: 20px;
}

/* Uploads */
.upload-preview {
    min-height: 58px;
    padding: 12px;
    background: #fbfcff;
    border: 1px dashed #bdc6d7;
    border-radius: 14px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.upload-preview.has-file {
    background: #f8fbff;
    border-color: #8bbfeb;
}

.upload-preview img {
    max-width: 160px;
    max-height: 130px;
    margin-right: 10px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.file-hint {
    color: var(--muted);
    font-size: 0.75rem;
}

.sidebar-backdrop,
.search-backdrop {
    display: none;
}

/* Progressive motion */
.ui-ready .reveal-item {
    opacity: 0;
    transform: translateY(10px);
}

.ui-ready .reveal-item.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 480ms var(--ease-out),
        transform 480ms var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
}

@keyframes heroFloat {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(0, -5px, 0); }
}

@keyframes balloonDrift {
    0%, 100% { transform: translate3d(0, 0, 0) rotate(-1deg); }
    50% { transform: translate3d(2px, -5px, 0) rotate(2deg); }
}

@keyframes progressBreathe {
    0%, 100% { transform: scaleX(0.96); filter: saturate(0.95); }
    50% { transform: scaleX(1); filter: saturate(1.15); }
}

@keyframes barPulse {
    0%, 100% { transform: scaleY(0.88); opacity: 0.8; }
    50% { transform: scaleY(1); opacity: 1; }
}

@keyframes toastIn {
    from { opacity: 0; transform: translate3d(18px, 0, 0) scale(0.98); }
    to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translate3d(0, 0, 0); }
    to { opacity: 0; transform: translate3d(12px, -4px, 0); }
}

@keyframes backdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes authIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes detailIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

















/* --------------------------------------------------------------------------
   Chiquilladas · Finance + Tasks integration
   -------------------------------------------------------------------------- */
.table-actions-nowrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.table-actions-nowrap form {
    margin: 0;
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.data-chip,
.count-chip,
.task-code-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border: 1px solid rgba(104, 35, 195, 0.12);
    border-radius: 999px;
    color: var(--purple);
    background: rgba(104, 35, 195, 0.07);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
}

.data-chip {
    margin-top: 4px;
}

.app-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.app-alert strong {
    flex: 0 0 auto;
}

.app-alert span {
    color: var(--ink-soft);
}

.app-alert.warning {
    border-color: rgba(255, 159, 15, 0.28);
    background: rgba(255, 159, 15, 0.08);
}

.app-alert.info {
    border-color: rgba(18, 151, 232, 0.24);
    background: rgba(18, 151, 232, 0.07);
}

.finance-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.finance-kpi {
    position: relative;
    overflow: hidden;
    min-height: 136px;
    padding: 19px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.finance-kpi::after {
    content: '';
    position: absolute;
    right: -30px;
    bottom: -42px;
    width: 108px;
    height: 108px;
    border-radius: 50%;
    opacity: 0.11;
    background: currentColor;
}

.finance-kpi span,
.finance-kpi small {
    display: block;
}

.finance-kpi span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.finance-kpi strong {
    display: block;
    margin: 8px 0 4px;
    color: var(--ink);
    font-size: clamp(1.35rem, 2.1vw, 1.85rem);
    line-height: 1.05;
}

.finance-kpi small {
    color: var(--muted);
    font-size: 0.76rem;
}

.finance-kpi.income { color: var(--blue); }
.finance-kpi.expense { color: var(--pink); }
.finance-kpi.net { color: var(--green); }
.finance-kpi.pending { color: var(--orange); }

.finance-breakdown {
    display: grid;
    gap: 18px;
}

.finance-breakdown > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 4px 16px;
}

.finance-breakdown span {
    color: var(--muted);
    font-weight: 700;
}

.finance-breakdown strong {
    color: var(--ink);
    font-size: 1.05rem;
}

.finance-breakdown i {
    grid-column: 1 / -1;
    position: relative;
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef1f7;
}

.finance-breakdown i::after {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--value, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--purple), var(--pink));
}

.finance-breakdown small {
    grid-column: 1 / -1;
    color: var(--muted);
}

.finance-account-list {
    display: grid;
    gap: 8px;
}

.finance-account-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 12px;
    border-radius: 12px;
    color: var(--ink);
    background: var(--surface-soft);
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.finance-account-list a:hover {
    transform: translateX(2px);
    background: #f3effd;
}

.finance-account-list span,
.finance-account-list strong,
.finance-account-list small {
    display: block;
}

.finance-account-list small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.75rem;
}

.expense-mini-stats,
.account-detail-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.expense-mini-stats > div,
.expense-mini-stats > a,
.account-detail-kpis > div {
    min-height: 86px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 15px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 5px 16px rgba(47, 61, 113, 0.04);
}

.expense-mini-stats span,
.account-detail-kpis span {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.expense-mini-stats strong,
.account-detail-kpis strong {
    display: block;
    margin-top: 6px;
    font-size: 1.05rem;
}

.expense-list-card {
    padding: 0;
}

.expense-origin span,
.expense-origin strong,
.expense-concept strong,
.expense-concept small {
    display: block;
}

.expense-origin span,
.expense-concept small {
    color: var(--muted);
    font-size: 0.75rem;
}

.expense-origin strong {
    margin-top: 2px;
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.expense-row-incomplete td {
    background: rgba(255, 159, 15, 0.035);
}

.verification-incomplete {
    color: #95600d;
    border-color: rgba(255, 159, 15, 0.24);
    background: rgba(255, 159, 15, 0.10);
}

.expense-editor {
    max-width: 1180px;
    margin-inline: auto;
}

.expense-orders {
    min-height: 144px;
}

.incomplete-card {
    border-color: rgba(255, 159, 15, 0.25);
    background: linear-gradient(180deg, rgba(255, 250, 240, 0.88), #fff 46%);
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.account-card {
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.account-card.is-inactive {
    opacity: 0.67;
    background: #f8f9fc;
}

.account-card-head {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.account-card-head strong,
.account-card-head small {
    display: block;
}

.account-card-head small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.74rem;
}

.account-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    font-weight: 900;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #b8becb;
}

.status-dot.active {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(50, 191, 91, 0.10);
}

.account-balance {
    margin: 18px 0 14px;
    padding: 13px 14px;
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(104, 35, 195, 0.07), rgba(240, 19, 114, 0.04));
}

.account-balance span,
.account-balance strong {
    display: block;
}

.account-balance span {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
}

.account-balance strong {
    margin-top: 4px;
    font-size: 1.35rem;
}

.account-flow {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

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

.account-flow span,
.account-flow b {
    display: block;
}

.account-flow span {
    color: var(--muted);
    font-size: 0.66rem;
}

.account-flow b {
    margin-top: 2px;
    overflow: hidden;
    font-size: 0.76rem;
    text-overflow: ellipsis;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.account-actions form {
    margin: 0;
}

.account-detail-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Tasks */
.task-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.task-metric {
    position: relative;
    min-height: 112px;
    overflow: hidden;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--ink);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.task-metric::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -28px;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.08;
}

.task-metric span,
.task-metric strong,
.task-metric small {
    display: block;
}

.task-metric span {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
}

.task-metric strong {
    margin-top: 3px;
    font-size: 1.65rem;
    line-height: 1.15;
}

.task-metric small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.72rem;
}

.task-metric.pending { color: var(--orange); }
.task-metric.progress { color: var(--blue); }
.task-metric.blocked { color: var(--pink); }
.task-metric.overdue { color: var(--red); }
.task-metric.done { color: var(--green); }

.task-title-cell small,
.task-title-cell a {
    display: block;
}

.task-title-cell small {
    color: var(--muted);
    font-size: 0.69rem;
    font-weight: 700;
}

.task-title-cell a {
    margin-top: 2px;
    color: var(--ink);
    font-weight: 800;
}

.task-title-cell a:hover {
    color: var(--purple);
}

.task-assignees {
    display: block;
    max-width: 230px;
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.task-state,
.task-priority,
.task-overdue-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 27px;
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.71rem;
    font-weight: 800;
    white-space: nowrap;
}

.task-state.state-pendiente { color: #97640a; background: rgba(255,159,15,.10); border-color: rgba(255,159,15,.18); }
.task-state.state-en_progreso { color: #066ca9; background: rgba(18,151,232,.10); border-color: rgba(18,151,232,.18); }
.task-state.state-bloqueada { color: #b20f58; background: rgba(240,19,114,.08); border-color: rgba(240,19,114,.16); }
.task-state.state-completada { color: #157e35; background: rgba(50,191,91,.10); border-color: rgba(50,191,91,.18); }
.task-state.state-cancelada { color: #677087; background: #f0f2f6; border-color: #e2e6ee; }

.task-priority.priority-baja { color: #61708d; background: #f3f5f8; }
.task-priority.priority-media { color: #5c22a1; background: rgba(104,35,195,.08); }
.task-priority.priority-alta { color: #b86b00; background: rgba(255,159,15,.11); }
.task-priority.priority-critica { color: #ba2941; background: rgba(233,74,102,.10); }

.task-overdue-chip {
    color: #ba2941;
    background: rgba(233,74,102,.10);
    border-color: rgba(233,74,102,.18);
}

.task-row-overdue td {
    background: rgba(233,74,102,.025);
}

.task-assignment-grid {
    display: grid;
    gap: 9px;
}

.task-person-check {
    display: grid;
    grid-template-columns: auto 38px minmax(0,1fr);
    align-items: center;
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 13px;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.task-person-check:hover {
    transform: translateY(-1px);
    border-color: rgba(104,35,195,.20);
    background: rgba(104,35,195,.03);
}

.task-person-check input {
    width: 17px;
    height: 17px;
    accent-color: var(--purple);
}

.task-person-check strong,
.task-person-check small {
    display: block;
}

.task-person-check small {
    color: var(--muted);
    font-size: 0.72rem;
}

.task-person-avatar {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    font-weight: 900;
}

.sticky-form-actions {
    position: sticky;
    z-index: 10;
    bottom: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    width: max-content;
    margin: 18px 0 0 auto;
    padding: 8px;
    border: 1px solid rgba(215,222,234,.9);
    border-radius: 14px;
    background: rgba(255,255,255,.90);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.task-detail-top,
.task-state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.task-description {
    margin: 18px 0;
    color: var(--ink-soft);
    font-size: 0.96rem;
    line-height: 1.7;
}

.task-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 10px;
}

.task-detail-grid > div {
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-soft);
}

.task-detail-grid span,
.task-detail-grid strong {
    display: block;
}

.task-detail-grid span {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
}

.task-detail-grid strong {
    margin-top: 3px;
    font-size: 0.84rem;
}

.task-recurrence-note {
    margin-top: 12px;
    padding: 11px 12px;
    border-left: 3px solid var(--purple);
    border-radius: 0 10px 10px 0;
    color: var(--ink-soft);
    background: rgba(104,35,195,.05);
}

.task-responsible-list,
.task-comment-list {
    display: grid;
    gap: 10px;
}

.task-responsible {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: var(--surface-soft);
}

.task-responsible strong,
.task-responsible small {
    display: block;
}

.task-responsible small {
    color: var(--muted);
    font-size: 0.72rem;
}

.task-comment {
    display: grid;
    grid-template-columns: 38px minmax(0,1fr);
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.task-comment:first-child {
    border-top: 0;
}

.task-comment-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.task-comment-head small {
    color: var(--muted);
    font-size: 0.7rem;
}

.task-comment p {
    margin: 5px 0 0;
    color: var(--ink-soft);
}

.danger-zone-card {
    border-color: rgba(233,74,102,.16);
}

.dashboard-task-summary {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.dashboard-task-summary div {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-soft);
}

.dashboard-task-summary span,
.dashboard-task-summary strong {
    display: block;
}

.dashboard-task-summary span {
    color: var(--muted);
    font-size: 0.69rem;
    font-weight: 800;
}

.dashboard-task-summary strong {
    margin-top: 2px;
    font-size: 1.05rem;
}

.dashboard-task-summary .has-alert {
    color: var(--red);
    background: rgba(233,74,102,.07);
}

.dashboard-task-list {
    display: grid;
}

.dashboard-task-list > a {
    display: grid;
    grid-template-columns: 10px minmax(0,1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 4px;
    border-top: 1px solid var(--line);
    color: var(--ink);
}

.dashboard-task-list > a .task-state {
    min-width: 8px;
    min-height: 8px;
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
}

.dashboard-task-list strong,
.dashboard-task-list small {
    display: block;
}

.dashboard-task-list small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.72rem;
}


#expenseOrdersGroup.is-disabled {
    opacity: 0.52;
}

#expenseOrdersGroup.is-disabled .expense-orders {
    background: #f4f6f9;
}
.verification-summary {
    color: #5f6d89;
    border-color: #dfe4ec;
    background: #f4f6f9;
}
.task-person-check.is-readonly{cursor:default;background:var(--bs-light,#f8f9fa);border-style:dashed}.task-assignment-note{padding:14px 16px;border:1px dashed rgba(93,57,161,.24);border-radius:16px;color:#6e7893;background:rgba(125,91,190,.045);font-size:.86rem}

/* =========================================================
   Chiquilladas · Finanzas + Tareas · Integración final
   ========================================================= */
.task-assignment-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin:0 0 14px;
    padding:10px 12px;
    border:1px solid rgba(95,64,156,.10);
    border-radius:14px;
    background:linear-gradient(180deg,rgba(116,78,180,.055),rgba(116,78,180,.025));
    color:#6d7690;
    font-size:.82rem;
}
.task-assignment-toolbar strong{color:#5c35a4;font-size:.95rem}
.task-assignment-toolbar>div{display:flex;flex-wrap:wrap;gap:6px}
.task-person-check:has(input:checked){
    border-color:rgba(101,57,171,.30);
    background:linear-gradient(180deg,rgba(113,70,185,.085),rgba(113,70,185,.035));
    box-shadow:0 8px 22px rgba(88,53,143,.07);
}
.task-person-check:has(input:checked) .task-person-avatar{
    transform:scale(1.04);
    box-shadow:0 0 0 4px rgba(114,76,184,.08);
}
.task-recurrence-rule{
    transition:opacity .18s ease,filter .18s ease;
}
.task-recurrence-rule.is-muted{opacity:.58;filter:saturate(.72)}
.task-form .sticky-form-actions{
    backdrop-filter:blur(12px);
    -webkit-backdrop-filter:blur(12px);
}
.account-card .account-actions .btn,
.expense-list-card .table-actions-nowrap .btn,
.task-table-card .table-actions-nowrap .btn{
    min-height:34px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
}
.account-card-head .status-dot{
    flex:0 0 auto;
}
.account-detail-kpis>div{
    min-width:0;
}
.account-detail-kpis strong{
    overflow-wrap:anywhere;
}
.incomplete-card{
    border-color:rgba(235,155,31,.15);
    background:linear-gradient(180deg,#fffdfa,#fff);
}
.expense-row-incomplete{
    --bs-table-bg:rgba(255,248,235,.64);
}
.verification-incomplete{
    color:#9a6512;
    background:rgba(240,163,41,.10);
    border-color:rgba(240,163,41,.20);
}


/* =========================================================
   Chiquilladas UI v3 · Responsive real + Finanzas + Personal
   Bloque final de estabilización. Mantener al final del archivo.
   ========================================================= */

:root {
    --content-max: 1560px;
    --content-gutter: clamp(14px, 2.2vw, 30px);
    --touch-min: 42px;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.app-frame,
.app-stage,
.app-content,
.app-topbar,
.page-header,
.chq-card,
.card,
.row,
[class*="col-"] {
    min-width: 0;
}

.app-stage {
    max-width: 100%;
}

.app-content {
    width: min(100%, var(--content-max));
    max-width: var(--content-max);
    padding-right: var(--content-gutter);
    padding-left: var(--content-gutter);
}

.app-content.container-fluid {
    --bs-gutter-x: 0;
}

.form-control,
.form-select,
.btn {
    min-height: var(--touch-min);
}

.btn-sm {
    min-height: 34px;
}

.form-control,
.form-select {
    max-width: 100%;
}

textarea.form-control {
    min-height: 110px;
}

/* Finanzas: tabs fluidos, táctiles y sin desbordes */
.tabs-finance {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin: 0 0 18px;
}

.tabs-finance > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    color: #52607b;
    background: rgba(255,255,255,.78);
    white-space: nowrap;
}

.tabs-finance > a:hover {
    color: var(--purple);
    border-color: rgba(104,35,195,.25);
    background: #fff;
}

.tabs-finance > a.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--purple), var(--purple-2));
    box-shadow: 0 9px 22px rgba(104,35,195,.18);
}

/* Filtros: reemplaza filas rígidas por grid real */
.filter-card {
    width: 100%;
    padding: 16px;
    overflow: visible;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
}

.filter-field {
    grid-column: span 2;
    min-width: 0;
}

.filter-field-grow {
    grid-column: span 4;
}

.filter-actions {
    grid-column: span 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.filter-actions .btn {
    flex: 1 1 auto;
}

.filter-grid-compact .filter-field-grow {
    grid-column: span 9;
}

.filter-grid-compact .filter-actions {
    grid-column: span 3;
}

.finance-movement-filter-grid .filter-field-grow {
    grid-column: span 4;
}

/* Seguimiento individual desde Personal */
.tracking-context {
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) minmax(360px, 2fr) auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 15px 16px;
    border: 1px solid rgba(104,35,195,.13);
    border-radius: 18px;
    background:
        radial-gradient(circle at 90% 0, rgba(65,199,244,.09), transparent 14rem),
        linear-gradient(135deg, #fff, #fcf9ff);
    box-shadow: var(--shadow-sm);
}

.tracking-person {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tracking-person > div {
    min-width: 0;
}

.tracking-label,
.card-kicker {
    display: block;
    margin-bottom: 2px;
    color: var(--purple);
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.tracking-person h2 {
    margin: 0;
    overflow: hidden;
    font-size: 1.05rem;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tracking-person p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: .77rem;
}

.tracking-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 8px;
    min-width: 0;
}

.tracking-kpis > div {
    min-width: 0;
    padding: 9px 10px;
    border-radius: 12px;
    background: var(--surface-soft);
}

.tracking-kpis span,
.tracking-kpis strong {
    display: block;
}

.tracking-kpis span {
    color: var(--muted);
    font-size: .66rem;
    font-weight: 800;
}

.tracking-kpis strong {
    margin-top: 2px;
    overflow: hidden;
    font-size: .88rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tracking-kpis .has-alert {
    color: #b56600;
    background: rgba(255,159,15,.09);
}

.tracking-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

/* Cuentas financieras */
.finance-account-layout {
    display: grid;
    grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
    align-items: start;
    gap: 22px;
    width: 100%;
}

.finance-account-layout.without-editor {
    grid-template-columns: minmax(0,1fr);
}

.account-editor-column,
.account-list-column {
    min-width: 0;
}

.account-editor {
    position: sticky;
    top: calc(var(--topbar-height) + 18px);
    overflow: hidden;
}

.account-editor .card-title-row {
    margin-bottom: 16px;
}

.account-editor h2 {
    margin: 0;
    color: #4d278a;
    font-size: 1.08rem;
}

.account-editor p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: .79rem;
}

.form-stack {
    display: grid;
    gap: 13px;
}

.account-editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.account-editor-actions .btn {
    flex: 1 1 0;
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    align-items: stretch;
    gap: 16px;
}

.account-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.account-card.is-inactive {
    opacity: .74;
    background: #fafbfe;
}

.account-card-head {
    display: grid;
    grid-template-columns: 40px minmax(0,1fr) auto;
    align-items: center;
    gap: 10px;
}

.account-heading {
    min-width: 0;
}

.account-heading strong,
.account-heading small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-heading strong {
    color: var(--ink);
    font-size: .94rem;
}

.account-heading small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .72rem;
}

.account-balance {
    margin: 14px 0 10px;
    padding: 13px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(104,35,195,.07), rgba(240,19,114,.045));
}

.account-balance span,
.account-balance strong {
    display: block;
}

.account-balance span {
    color: var(--muted);
    font-size: .69rem;
    font-weight: 800;
}

.account-balance strong {
    margin-top: 3px;
    overflow-wrap: anywhere;
    font-size: 1.35rem;
    line-height: 1.15;
}

.account-flow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 7px;
    margin-bottom: 14px;
}

.account-flow > div {
    min-width: 0;
    padding: 8px 9px;
    border-radius: 11px;
    background: var(--surface-soft);
}

.account-flow span,
.account-flow b {
    display: block;
}

.account-flow span {
    overflow: hidden;
    color: var(--muted);
    font-size: .64rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-flow b {
    margin-top: 2px;
    overflow-wrap: anywhere;
    font-size: .78rem;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: auto;
}

.account-actions form {
    display: inline-flex;
    margin: 0;
}

/* Personal */
.people-filter {
    margin-bottom: 16px;
}

.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
    gap: 16px;
}

.person-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.person-card.is-inactive {
    opacity: .72;
    background: #fafbfe;
}

.person-card-head {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-width: 0;
}

.person-avatar {
    display: grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    place-items: center;
    color: #fff;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    box-shadow: 0 8px 18px rgba(104,35,195,.16);
    font-weight: 900;
}

.person-avatar.compact {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.person-identity {
    min-width: 0;
    flex: 1;
}

.person-title-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.person-title-line h2 {
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    font-size: .98rem;
    font-weight: 850;
    line-height: 1.25;
    text-overflow: ellipsis;
}

.person-identity p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: .74rem;
}

.person-email {
    display: block;
    max-width: 100%;
    margin-top: 2px;
    overflow: hidden;
    font-size: .72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.person-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 7px;
    margin: 15px 0 10px;
}

.person-kpis > div {
    min-width: 0;
    padding: 9px 8px;
    border-radius: 11px;
    background: var(--surface-soft);
}

.person-kpis span,
.person-kpis strong {
    display: block;
}

.person-kpis span {
    min-height: 2.2em;
    color: var(--muted);
    font-size: .62rem;
    font-weight: 800;
    line-height: 1.1;
}

.person-kpis strong {
    margin-top: 3px;
    font-size: 1rem;
}

.person-kpis .has-alert {
    color: #bc3147;
    background: rgba(233,74,102,.075);
}

.person-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
    padding: 10px 0 12px;
    border-top: 1px solid var(--line);
}

.person-meta span,
.person-meta strong {
    display: block;
}

.person-meta span {
    color: var(--muted);
    font-size: .64rem;
    font-weight: 800;
}

.person-meta strong {
    margin-top: 2px;
    overflow-wrap: anywhere;
    font-size: .72rem;
}

.person-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.person-actions form {
    display: inline-flex;
    margin: 0;
}

/* Movimientos */
.movement-list-card {
    overflow: hidden;
}

.movement-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: .69rem;
    font-weight: 800;
}

.movement-pago { color: #19783a; background: rgba(50,191,91,.10); }
.movement-devolucion { color: #b4344b; background: rgba(233,74,102,.10); }
.movement-gasto { color: #8c5b00; background: rgba(255,159,15,.11); }

.movement-concept {
    min-width: 190px;
    max-width: 310px;
    white-space: normal;
}

/* Evitar que tablas o bootstrap fuercen el ancho del viewport */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.app-table {
    width: 100%;
    max-width: 100%;
}

.app-table th,
.app-table td {
    vertical-align: middle;
}











/* =========================================================
   Chiquilladas UI v4 · HTML5 semántico + seguimiento personal
   Ajustes finales de estructura, accesibilidad y adaptación.
   ========================================================= */

/* Evita que un hijo flex/grid obligue a la página a crecer horizontalmente. */
.app-frame,
.app-stage,
.app-content,
.app-content > *,
.finance-account-layout,
.account-list-column,
.account-editor-column,
.people-grid,
.tracking-context,
.table-responsive {
    min-width: 0;
}

/* Encabezados semánticos conservan la presentación existente. */
header.page-header,
header.card-title-row,
header.person-card-head,
header.account-card-head,
footer.person-actions,
footer.account-actions {
    margin-block: 0;
}

/* Breadcrumb semántico. */
nav.topbar-breadcrumb {
    margin: 0;
}

/* Títulos y metadatos de cuentas usando HTML5/definition lists. */
.account-heading h3,
.account-heading p {
    display: block;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-heading h3 {
    color: var(--ink);
    font-size: .94rem;
    font-weight: 800;
    line-height: 1.25;
}

.account-heading p {
    margin-top: 2px;
    color: var(--muted);
    font-size: .72rem;
}

.account-flow,
.person-meta {
    margin-bottom: 0;
}

.account-flow dt,
.account-flow dd,
.person-meta dt,
.person-meta dd {
    margin: 0;
}

.account-flow dt {
    overflow: hidden;
    color: var(--muted);
    font-size: .64rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-flow dd {
    margin-top: 2px;
    overflow-wrap: anywhere;
    color: var(--ink);
    font-size: .78rem;
    font-weight: 800;
}

.person-meta dt {
    color: var(--muted);
    font-size: .67rem;
    font-weight: 700;
}

.person-meta dd {
    margin-top: 2px;
    color: var(--ink);
    font-size: .76rem;
    font-weight: 750;
    overflow-wrap: anywhere;
}

/* El seguimiento de personal no debe parecer una cuenta bancaria del empleado. */
.tracking-context {
    isolation: isolate;
}

.tracking-context::before {
    content: "Actividad registrada por esta cuenta de usuario";
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Acciones estables incluso con textos más largos. */
.person-actions,
.account-actions {
    gap: 7px;
}

.person-actions > a,
.person-actions > form,
.account-actions > a,
.account-actions > form {
    min-width: 0;
}

.person-actions form,
.account-actions form {
    margin: 0;
}

/* Las tarjetas financieras no deben heredar anchos de .row/.col de Bootstrap. */
.finance-account-layout > *,
.account-grid > *,
.people-grid > * {
    width: auto;
    max-width: 100%;
}

/* Mantiene formularios y controles dentro de su columna real. */
.form-control,
.form-select,
.input-group,
.filter-field,
.filter-actions {
    min-width: 0;
}

.form-control,
.form-select {
    width: 100%;
}

/* Tablas grandes: desktop con scroll controlado, móvil mediante cards del JS. */
.table-responsive {
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.app-table {
    width: 100%;
}

.app-table th,
.app-table td {
    vertical-align: middle;
}

.app-table th {
    white-space: nowrap;
}

/* Focus accesible uniforme. */
.app-nav-link:focus-visible,
.tabs-finance a:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.user-menu:focus-visible,
.icon-button:focus-visible {
    outline: 3px solid rgba(104, 35, 195, .22);
    outline-offset: 2px;
}

/* Sidebar y stage: la navegación nunca reduce el viewport útil en tablet/móvil. */


.tracking-note {
    display: block;
    max-width: 360px;
    margin-top: 4px;
    color: #7b849a;
    font-size: .68rem;
    line-height: 1.4;
}


/* Automation + multi-agent management */
.automation-grid,.agent-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.automation-card,.agent-card{min-width:0}.cron-expression{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.83rem;background:#f3f5fb;border:1px solid #e3e7f1;border-radius:10px;padding:7px 10px;white-space:nowrap}.status-pill{display:inline-flex;align-items:center;border-radius:999px;padding:4px 8px;font-size:.72rem;font-weight:700;text-transform:capitalize;background:#eef1f6;color:#586174}.status-ok,.status-activa,.status-idle,.status-procesado{background:#e9f8ef;color:#227a47}.status-muted,.status-pausado,.status-cancelado,.status-expirada{background:#f0f1f4;color:#697080}.status-error,.status-fallido,.status-rechazada{background:#fff0f0;color:#b83a3a}.status-ejecutando,.status-procesando,.status-candidata,.status-reintento{background:#fff6e5;color:#9c681a}.automation-meta,.agent-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.automation-meta span,.agent-meta span{background:#f8f9fc;border:1px solid #edf0f5;border-radius:10px;padding:9px 10px;font-size:.82rem;min-width:0;overflow-wrap:anywhere}.automation-meta b,.agent-meta b{display:block;color:#72798a;font-size:.68rem;text-transform:uppercase;letter-spacing:.05em;margin-bottom:2px}.history-result{max-width:520px;white-space:normal;overflow-wrap:anywhere}.agent-type{display:inline-block;font-size:.68rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:#7452c8}.mini-chip{font-size:.7rem;padding:4px 8px;border-radius:999px;background:#f0ecff;color:#6d4fbd}.agent-prompt{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.84rem}.agent-prompt-preview{background:#faf9ff;border:1px solid #ebe6fb;border-radius:12px;padding:14px;white-space:normal;max-height:340px;overflow:auto}.tool-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.tool-choice{display:flex;gap:9px;align-items:flex-start;border:1px solid #e7e9ef;border-radius:12px;padding:10px;background:#fff}.tool-choice input{margin-top:3px}.tool-choice span{display:flex;flex-direction:column}.tool-choice small{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:#7a8190}.agent-switches{display:flex;flex-wrap:wrap;gap:18px;padding:12px;border:1px solid #e8eaf0;border-radius:12px;background:#fafbfe}.agent-definition{display:grid;grid-template-columns:100px 1fr;gap:8px 12px;margin:0}.agent-definition dt{color:#747b8b;font-size:.78rem}.agent-definition dd{margin:0;overflow-wrap:anywhere}.memory-list{display:grid;gap:10px}.memory-item{display:flex;justify-content:space-between;gap:14px;border:1px solid #eceef3;border-radius:12px;padding:12px}.memory-item p{margin:7px 0 0}.studio-output{margin-top:18px;min-height:260px;border-radius:16px;padding:22px;background:linear-gradient(145deg,#fff,#f8f6ff);border:1px solid #ece7fa;font-size:1.03rem;line-height:1.75}.studio-history{display:grid;gap:8px}.studio-history details{border:1px solid #e9ebf0;border-radius:12px;padding:10px 12px}.studio-history summary{cursor:pointer;display:flex;justify-content:space-between;gap:14px}.studio-history summary small{color:#7d8390}.studio-history details>div{padding:12px 2px 2px;line-height:1.65}.studio-form .form-control,.studio-form .form-select{min-height:44px}

/* ==========================================================================
   Profile + Telegram agent linking
   ========================================================================== */
.profile-page-header {
    align-items: center;
}

.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .8fr);
    gap: 18px;
    margin-bottom: 18px;
}

.profile-card {
    min-width: 0;
    padding: 22px;
}

.profile-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.profile-card-heading h2,
.telegram-card-title h2,
.telegram-workflow-copy h3 {
    margin: 4px 0 0;
    color: #261743;
    font-weight: 820;
    letter-spacing: -.018em;
}

.profile-card-heading h2,
.telegram-card-title h2 {
    font-size: 1.2rem;
}

.profile-card-heading p,
.telegram-card-title p,
.telegram-workflow-copy p {
    margin: 5px 0 0;
    color: var(--muted);
}

.profile-card-kicker {
    display: inline-flex;
    color: var(--purple);
    font-size: .69rem;
    font-weight: 850;
    letter-spacing: .085em;
    text-transform: uppercase;
}

.profile-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.profile-telegram-card {
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    padding: 0;
}

.profile-telegram-card::before {
    content: "";
    position: absolute;
    top: -90px;
    right: -60px;
    width: 260px;
    height: 260px;
    pointer-events: none;
    background: radial-gradient(circle, rgba(18, 151, 232, .12), rgba(18, 151, 232, 0) 68%);
}

.telegram-card-header {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 22px 24px;
    background: linear-gradient(145deg, #fff 0%, #f8fcff 100%);
    border-bottom: 1px solid var(--line);
}

.telegram-brand-mark {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    color: #fff;
    background: linear-gradient(135deg, #1199e8, #4bc5f4);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(18, 151, 232, .22);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .06em;
}

.telegram-card-title {
    min-width: 0;
}

.telegram-card-title p {
    max-width: 820px;
}

.telegram-connection-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 11px;
    color: #786b7a;
    background: #f7f4f8;
    border: 1px solid #ece6ef;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 800;
    white-space: nowrap;
}

.telegram-connection-badge i,
.person-telegram-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    background: #a7afbc;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(116, 128, 154, .08);
}

.telegram-connection-badge.is-connected {
    color: #167a45;
    background: #edf9f2;
    border-color: #cfefdc;
}

.telegram-connection-badge.is-connected i {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(50, 191, 91, .10);
}

.telegram-config-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 18px 24px 0;
    padding: 13px 15px;
    color: #775418;
    background: #fff8e7;
    border: 1px solid #f1dfb3;
    border-radius: 13px;
}

.telegram-config-warning strong,
.telegram-config-warning span {
    display: block;
}

.telegram-config-warning span {
    color: #836c3c;
    font-size: .82rem;
}

.telegram-link-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 20px 24px 0;
}

.telegram-status-panel,
.telegram-agent-panel {
    min-width: 0;
    padding: 17px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.telegram-status-panel:hover,
.telegram-agent-panel:hover {
    border-color: #d7e1ee;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.telegram-panel-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 14px;
}

.telegram-panel-heading > div {
    min-width: 0;
}

.telegram-panel-heading strong,
.telegram-panel-heading small {
    display: block;
}

.telegram-panel-heading strong {
    color: var(--ink);
    font-size: .93rem;
}

.telegram-panel-heading small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .72rem;
}

.telegram-panel-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    color: #087fca;
    background: #edf8ff;
    border-radius: 11px;
    font-weight: 900;
}

.telegram-panel-icon.is-agent {
    color: var(--purple);
    background: #f3efff;
    font-size: .7rem;
}

.telegram-account-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 0 0 15px;
}

.telegram-account-summary > div {
    min-width: 0;
    padding: 10px 11px;
    background: #fafbfe;
    border: 1px solid #edf0f5;
    border-radius: 11px;
}

.telegram-account-summary dt {
    color: var(--muted);
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.telegram-account-summary dd {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
    color: var(--ink-soft);
    font-size: .82rem;
    font-weight: 700;
}

.telegram-empty-state {
    display: grid;
    gap: 5px;
    min-height: 116px;
    align-content: center;
    padding: 18px;
    color: #607089;
    text-align: center;
    background: #fafcff;
    border: 1px dashed #cbd7e8;
    border-radius: 13px;
}

.telegram-empty-state strong {
    color: var(--ink);
}

.telegram-empty-state span {
    font-size: .82rem;
}

.telegram-agent-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    background: linear-gradient(135deg, #f8f4ff, #f3fbff);
    border: 1px solid #e8e0f8;
    border-radius: 14px;
}

.telegram-agent-avatar {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    color: #fff;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(104, 35, 195, .18);
}

.telegram-agent-card > div:last-child {
    min-width: 0;
}

.telegram-agent-card strong,
.telegram-agent-card span,
.telegram-agent-card small {
    display: block;
}

.telegram-agent-card strong {
    overflow: hidden;
    color: #351263;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.telegram-agent-card span {
    margin-top: 2px;
    color: #765ba3;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .72rem;
}

.telegram-agent-card small {
    margin-top: 3px;
    color: var(--muted);
}

.telegram-security-note {
    margin: 13px 0 0;
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.55;
}

.telegram-link-workflow {
    position: relative;
    z-index: 1;
    margin: 20px 24px 24px;
    padding: 20px;
    background: linear-gradient(145deg, #fcfdff, #f7f9ff);
    border: 1px solid #e4eaf5;
    border-radius: 18px;
}

.telegram-workflow-copy {
    max-width: 800px;
    margin-bottom: 15px;
}

.telegram-workflow-copy h3 {
    font-size: 1.06rem;
}

.telegram-code-box,
.telegram-command-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 11px;
    padding: 13px 14px;
    background: #fff;
    border: 1px solid #dce5f2;
    border-radius: 13px;
}

.telegram-code-box > div {
    min-width: 0;
}

.telegram-code-box span,
.telegram-code-box strong,
.telegram-code-box small {
    display: block;
}

.telegram-code-box span {
    color: var(--muted);
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.telegram-code-box strong {
    margin-top: 3px;
    color: #24143b;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.02rem;
    letter-spacing: .06em;
    overflow-wrap: anywhere;
}

.telegram-code-box small {
    margin-top: 2px;
    color: var(--muted);
}

.telegram-command-box code {
    min-width: 0;
    overflow-wrap: anywhere;
    color: #6418a8;
}

.telegram-open-bot {
    margin-top: 11px;
}

.telegram-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.telegram-steps li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    background: rgba(255, 255, 255, .8);
    border: 1px solid #e6ebf3;
    border-radius: 13px;
}

.telegram-steps li > span {
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    color: #fff;
    background: var(--purple);
    border-radius: 9px;
    font-size: .72rem;
    font-weight: 900;
}

.telegram-steps strong,
.telegram-steps small {
    display: block;
}

.telegram-steps strong {
    color: var(--ink);
    font-size: .82rem;
}

.telegram-steps small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .72rem;
    line-height: 1.45;
}

.telegram-link-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.telegram-pending-note {
    color: var(--muted);
    font-size: .76rem;
}

.person-telegram {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 7px;
    color: #7a8394;
    font-size: .72rem;
    font-weight: 700;
}

.person-telegram.is-linked {
    color: #157846;
}

.person-telegram.is-linked .person-telegram-dot {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(50, 191, 91, .09);
}

/* Route-level hooks: every rendered view receives a stable body class. */
body[class*="view-"] .app-content > .page-header:first-child,
body[class*="view-"] .app-content > header.page-header:first-child {
    animation: viewHeaderIn 320ms var(--ease-out) both;
}

@keyframes viewHeaderIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.people-telegram-hint {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    margin-bottom: 16px;
    padding: 13px 15px;
    color: #35506d;
    background: linear-gradient(135deg, #f2faff, #faf7ff);
    border: 1px solid #dce8f5;
    border-radius: 15px;
}

.people-telegram-hint-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: #fff;
    background: linear-gradient(135deg, #149ae9, #55c9f3);
    border-radius: 11px;
    font-size: .68rem;
    font-weight: 900;
}

.people-telegram-hint strong,
.people-telegram-hint span {
    display: block;
}

.people-telegram-hint strong {
    color: #20304a;
    font-size: .86rem;
}

.people-telegram-hint div > span {
    margin-top: 2px;
    color: #68768d;
    font-size: .77rem;
}

/* ========================================================================== 
   CHIQUILLADAS DASH 4.0 — CAPA VISUAL DE MÓDULOS NUEVOS
   Configuración, proveedores IA, agentes, automatización, Media Studio,
   verificación documental, estados operativos y componentes de administración.
   ========================================================================== */

:root {
    --content-gutter: 28px;
    --touch-min: 42px;
    --panel-radius: 18px;
    --panel-line: #e4e9f3;
    --panel-soft: #f8faff;
    --panel-soft-purple: #f7f2ff;
    --panel-soft-blue: #f1f9ff;
    --panel-soft-green: #effaf3;
    --panel-soft-amber: #fff8e8;
    --panel-soft-red: #fff1f3;
    --ai-violet: #6f35c5;
    --ai-cyan: #26bce7;
    --success-strong: #16834c;
    --warning-strong: #a96900;
    --danger-strong: #b63d55;
}

/* ---------- Cabeceras de módulos y barras de acciones ---------- */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 20px;
}

.page-header > div {
    min-width: 0;
}

.page-header h1 {
    margin: 5px 0 5px;
    color: #32115e;
    font-size: clamp(1.75rem, 2.6vw, 2.35rem);
    font-weight: 850;
    line-height: 1.06;
    letter-spacing: -.028em;
}

.page-header p {
    max-width: 820px;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.page-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--purple);
    font-size: .70rem;
    font-weight: 900;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.page-eyebrow::before {
    content: "";
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    background: linear-gradient(135deg, var(--pink), var(--orange));
    border-radius: 50%;
    box-shadow: 0 0 0 5px rgba(240, 19, 114, .08);
}

/* ---------- Botones / estados administrativos ---------- */
.btn {
    min-height: 40px;
    border-radius: 11px;
    font-weight: 720;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0) scale(.985);
}

.btn-primary {
    background: linear-gradient(135deg, #6d27c5, #8e4ce6);
    border-color: #6d27c5;
    box-shadow: 0 8px 18px rgba(104,35,195,.18);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #5a1ead, #7b38d1);
    border-color: #5a1ead;
    box-shadow: 0 10px 24px rgba(104,35,195,.24);
}

.btn-success {
    background: linear-gradient(135deg, #169353, #32bf5b);
    border-color: #169353;
}

.btn-outline-primary { color: #6823c3; border-color: #b99ae4; }
.btn-outline-primary:hover { color: #fff; background: #6823c3; border-color: #6823c3; }
.btn-outline-warning { color: #8f5b00; border-color: #e5b449; }
.btn-outline-success { color: #177944; border-color: #7bc997; }
.btn-outline-danger { color: #b83c54; border-color: #eba2b1; }

.status-pill,
.verification-badge,
.count-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 25px;
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 850;
    line-height: 1.15;
    letter-spacing: .015em;
    white-space: nowrap;
}

.status-pill::before,
.verification-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    background: currentColor;
    border-radius: 50%;
    opacity: .72;
}

.status-ok,
.status-activa,
.status-activo,
.status-completado,
.status-finalizado,
.status-publicado,
.status-aplicado,
.status-procesado,
.status-listo,
.status-success,
.status-resuelto {
    color: #147a45;
    background: #eaf8ef;
    border-color: #cdecd8;
}

.status-ejecutando,
.status-procesando,
.status-pendiente,
.status-candidata,
.status-reintento,
.status-warning,
.status-reconocido {
    color: #966000;
    background: #fff6df;
    border-color: #f1dba4;
}

.status-error,
.status-fallido,
.status-rechazado,
.status-rechazada,
.status-cancelado,
.status-bloqueado {
    color: #b23b52;
    background: #fff0f3;
    border-color: #f3cbd3;
}

.status-muted,
.status-pausado,
.status-inactivo,
.status-expirada,
.status-borrador {
    color: #677084;
    background: #f1f3f7;
    border-color: #e0e4eb;
}

/* ---------- Tarjetas / paneles de trabajo ---------- */
.chq-card {
    padding: 18px;
}

.chq-card > h2:first-child,
.chq-card > h3:first-child {
    color: #35155f;
}

.chq-card .form-label {
    color: #35415f;
    font-size: .78rem;
    font-weight: 800;
}

.chq-card .form-text,
.form-hint,
.file-hint {
    color: #7b869d;
    font-size: .73rem;
    line-height: 1.45;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 43px;
    border-color: #dbe2ee;
    border-radius: 11px;
}

.form-control,
.form-select {
    color: var(--ink);
    background-color: #fff;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.form-control:hover,
.form-select:hover {
    border-color: #cbd4e4;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: #ad82e6;
    box-shadow: 0 0 0 .2rem rgba(104,35,195,.10);
}

.form-control::placeholder {
    color: #9aa4b7;
}

textarea.form-control {
    min-height: 110px;
    line-height: 1.55;
    resize: vertical;
}

.form-check-input:checked {
    background-color: var(--purple);
    border-color: var(--purple);
}

/* ---------- Configuración del sistema ---------- */
#settingsAccordion {
    display: grid;
    gap: 12px;
}

#settingsAccordion .accordion-item {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--panel-line);
    border-radius: 16px;
    box-shadow: 0 7px 20px rgba(47,61,113,.045);
}

#settingsAccordion .accordion-button {
    min-height: 58px;
    padding: 15px 18px;
    color: #34115f;
    background: linear-gradient(180deg, #fff, #fbfcff);
    font-size: .94rem;
    font-weight: 850;
    box-shadow: none;
}

#settingsAccordion .accordion-button:not(.collapsed) {
    color: #5a1da8;
    background: linear-gradient(135deg, #fbf8ff, #f3f9ff);
    border-bottom: 1px solid #e8e3f3;
}

#settingsAccordion .accordion-button::after {
    width: 18px;
    height: 18px;
    background-size: 18px;
}

#settingsAccordion .accordion-body {
    padding: 18px;
    background: #fff;
}

#settingsAccordion code,
.app-content form[action*="settings"] code {
    padding: 2px 6px;
    color: #5d2ca7;
    background: #f5efff;
    border: 1px solid #eadff8;
    border-radius: 7px;
    font-size: .72rem;
}

.app-content form[action*="settings/save"] input[type="password"] {
    padding-right: 42px;
    background-image: linear-gradient(90deg, rgba(104,35,195,.02), transparent 35%);
}

.app-content form[action*="settings/save"] .form-switch {
    min-height: 43px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px 8px 46px;
    background: #f8faff;
    border: 1px solid #e5eaf3;
    border-radius: 11px;
}

.app-content form[action*="settings/test-provider"] {
    display: inline-flex;
}

/* ---------- Media Studio ---------- */
.app-content form[action*="media/generate"] {
    position: relative;
}

.app-content form[action*="media/generate"]::before {
    content: "IA";
    position: absolute;
    right: 2px;
    top: -50px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #fff;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    border-radius: 13px;
    font-size: .70rem;
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(104,35,195,.18);
}

#mediaType {
    font-weight: 750;
    background-color: #fbfaff;
}

textarea[name="options_json"],
.agent-prompt,
.cron-expression {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

textarea[name="options_json"] {
    color: #3e2860;
    background: #faf8ff;
    border-color: #e4d9f4;
}

.app-content form[action*="media/"] .btn {
    white-space: nowrap;
}

.app-content form[action*="media/publish"] .btn-success {
    box-shadow: 0 7px 16px rgba(20,131,69,.14);
}

.app-content video.rounded,
.app-content img.img-fluid.rounded {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    background: #10131b;
    border: 1px solid #e0e5ef;
    box-shadow: 0 7px 20px rgba(31,43,85,.08);
}

/* tarjetas de activos multimedia dentro de las generaciones */
.app-content .chq-card .border.rounded-3.p-3.h-100 {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #fff, #fafcff);
    border-color: #e0e6f0 !important;
    border-radius: 14px !important;
}

.app-content .chq-card .border.rounded-3.p-3.h-100::after {
    content: "";
    position: absolute;
    inset: auto -35px -45px auto;
    width: 110px;
    height: 110px;
    pointer-events: none;
    background: radial-gradient(circle, rgba(65,199,244,.10), transparent 70%);
}

/* ---------- Automation / CRON health ---------- */
.automation-grid {
    align-items: stretch;
}

.automation-card {
    position: relative;
    overflow: hidden;
}

.automation-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, var(--purple), var(--pink), var(--orange));
    opacity: .65;
}

.automation-card:hover::before {
    opacity: 1;
}

.cron-expression {
    display: inline-flex;
    align-items: center;
    min-height: 33px;
    padding: 6px 9px;
    color: #3f2860;
    background: #f7f4fc;
    border: 1px solid #e5ddf1;
    border-radius: 9px;
    font-size: .76rem;
    font-weight: 750;
}

.automation-meta {
    margin-top: 4px;
}

.automation-meta span {
    background: #f9fbff;
    border-color: #e8edf5;
}

.automation-meta b {
    color: #7b8395;
}

/* health banner */
.app-content .alert code {
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 4px 8px;
    color: #4c2d70;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(104,35,195,.10);
    border-radius: 8px;
}

/* errores del sistema */
.app-content table td .status-pill {
    vertical-align: middle;
}

/* ---------- Agentes / orquestador ---------- */
.agent-grid {
    align-items: stretch;
}

.agent-card {
    position: relative;
}

.agent-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.agent-type::before {
    content: "AI";
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    color: #fff;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    border-radius: 8px;
    font-size: .54rem;
    font-weight: 900;
}

.agent-meta span {
    position: relative;
    padding-left: 12px;
}

.agent-prompt {
    line-height: 1.55;
    background: #fbf9ff;
}

.agent-prompt-preview {
    scrollbar-width: thin;
    scrollbar-color: #c9b4e7 transparent;
}

.tool-grid {
    align-items: stretch;
}

.tool-choice {
    min-height: 66px;
    background: linear-gradient(180deg, #fff, #fcfdff);
    border-color: #e4e8f0;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.tool-choice:hover {
    background: #fbf8ff;
    border-color: #d8c8ef;
    box-shadow: 0 7px 18px rgba(104,35,195,.07);
    transform: translateY(-1px);
}

.tool-choice:has(input:checked) {
    background: #f7f1ff;
    border-color: #b99be1;
    box-shadow: inset 0 0 0 1px rgba(104,35,195,.06);
}

.agent-switches {
    background: linear-gradient(135deg, #fafcff, #f9f6ff);
    border-color: #e4e5ef;
}

.agent-definition {
    padding: 13px;
    background: #fafcff;
    border: 1px solid #e6ebf3;
    border-radius: 12px;
}

.memory-item {
    background: #fff;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.memory-item:hover {
    border-color: #d9cbea;
    box-shadow: 0 8px 18px rgba(47,61,113,.06);
}

.studio-output {
    position: relative;
    overflow: hidden;
}

.studio-output::before {
    content: "Respuesta IA";
    display: inline-flex;
    margin-bottom: 10px;
    padding: 4px 8px;
    color: #6531a8;
    background: #eee4fb;
    border-radius: 999px;
    font-size: .65rem;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* ---------- Verificación documental / soportes ---------- */
.incomplete-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #fffaf0, #fff);
    border: 1px solid #f1dcaa;
    border-radius: 16px;
}

.incomplete-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--orange);
}

.evidence-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #126cb0;
    font-weight: 760;
}

.evidence-link::before {
    content: "↗";
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    color: #fff;
    background: var(--blue);
    border-radius: 6px;
    font-size: .65rem;
}

.verification-badge {
    border-width: 1px;
    border-style: solid;
}

.verification-pending,
.verification-pendiente {
    color: #946100;
    background: #fff5dd;
    border-color: #efd89e;
}

.verification-verificado,
.verification-aprobado {
    color: #177947;
    background: #eaf8ef;
    border-color: #cdebd7;
}

.verification-rechazado,
.verification-anulado {
    color: #b23d52;
    background: #fff0f3;
    border-color: #f2ccd4;
}

.upload-preview {
    display: grid;
    place-items: center;
    min-height: 78px;
    padding: 12px;
    color: #69758c;
    background: #f9fbff;
    border: 1px dashed #cfd8e6;
    border-radius: 12px;
}

.file-hint {
    display: block;
    margin-top: 5px;
}

.app-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 13px;
    font-size: .84rem;
    line-height: 1.5;
}

.app-alert.info {
    color: #245c80;
    background: #eef8ff;
    border-color: #cde8f7;
}

.app-alert.warning {
    color: #835a0a;
    background: #fff8e8;
    border-color: #efdcae;
}

.app-alert.success {
    color: #1f7047;
    background: #eef9f2;
    border-color: #d1ead9;
}

.app-alert.danger {
    color: #a43b50;
    background: #fff1f3;
    border-color: #f2d0d7;
}

.expense-editor,
.expense-orders {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.expense-editor {
    padding: 17px;
}

.expense-orders {
    padding: 13px;
}

/* ---------- Estados vacíos y cargas ---------- */
.empty-state {
    display: grid;
    place-items: center;
    min-height: 150px;
    padding: 28px 20px;
    color: #768198;
    text-align: center;
    background: linear-gradient(180deg, #fff, #fafcff);
    border: 1px dashed #cfd7e5;
    border-radius: 16px;
}

.empty-state::before {
    content: "• • •";
    display: block;
    margin-bottom: 8px;
    color: #ae8bd9;
    font-weight: 900;
    letter-spacing: .35em;
}

.loading-skeleton,
.skeleton-line,
.skeleton-block {
    position: relative;
    overflow: hidden;
    background: #edf1f7;
    border-radius: 9px;
}

.loading-skeleton::after,
.skeleton-line::after,
.skeleton-block::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 20%, rgba(255,255,255,.72) 50%, transparent 80%);
    transform: translateX(-100%);
    animation: chqSkeleton 1.5s ease-in-out infinite;
}

.skeleton-line { height: 13px; }
.skeleton-block { min-height: 110px; }

@keyframes chqSkeleton {
    100% { transform: translateX(100%); }
}

/* ---------- Tablas administrativas ---------- */
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: #cbd3e1 transparent;
}

.app-table,
.chq-card > .table-responsive > .table {
    margin-bottom: 0;
}

.app-table thead th,
.chq-card > .table-responsive > .table thead th {
    color: #6e7890;
    background: #f8faff;
    border-bottom-color: #e2e7f0;
    font-size: .69rem;
    font-weight: 900;
    letter-spacing: .035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-table tbody tr,
.chq-card > .table-responsive > .table tbody tr {
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.app-table tbody tr:hover,
.chq-card > .table-responsive > .table tbody tr:hover {
    background: #fcfbff;
}

.table-actions-nowrap {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    white-space: nowrap;
}

/* ---------- Seguridad / secretos ---------- */
.secret-field,
input[type="password"] {
    letter-spacing: .015em;
}

.secret-mask {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    color: #5e6474;
    background: #f2f4f7;
    border: 1px solid #e3e6ec;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .74rem;
}

.secret-mask::before {
    content: "●";
    color: var(--purple);
    font-size: .55rem;
}

/* ---------- Sistema de proveedor / conectividad ---------- */
.provider-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 12px;
}

.provider-card {
    min-width: 0;
    padding: 15px;
    background: linear-gradient(180deg, #fff, #fafcff);
    border: 1px solid var(--line);
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
}

.provider-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.provider-card strong {
    color: #32165b;
}

.provider-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    font-weight: 800;
}

.provider-status::before {
    content: "";
    width: 7px;
    height: 7px;
    background: currentColor;
    border-radius: 50%;
}

.provider-status.is-ok { color: var(--success-strong); }
.provider-status.is-warning { color: var(--warning-strong); }
.provider-status.is-error { color: var(--danger-strong); }

/* ---------- Indicadores de salud del sistema ---------- */
.health-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 12px;
}

.health-card {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-width: 0;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
}

.health-dot {
    width: 11px;
    height: 11px;
    flex: 0 0 11px;
    margin-top: 5px;
    background: #a0a8b7;
    border-radius: 50%;
    box-shadow: 0 0 0 5px rgba(116,128,154,.08);
}

.health-card.is-ok .health-dot { background: var(--green); box-shadow: 0 0 0 5px rgba(50,191,91,.10); }
.health-card.is-warning .health-dot { background: var(--orange); box-shadow: 0 0 0 5px rgba(255,159,15,.12); }
.health-card.is-error .health-dot { background: var(--red); box-shadow: 0 0 0 5px rgba(233,74,102,.10); }

.health-card strong,
.health-card small {
    display: block;
}

.health-card small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .72rem;
}

/* ---------- Utilidades 4.0 ---------- */
.code-box {
    overflow: auto;
    padding: 12px 13px;
    color: #dff4ff;
    background: #182139;
    border: 1px solid #25304b;
    border-radius: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .77rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 10px;
}

.meta-box {
    min-width: 0;
    padding: 10px 11px;
    background: #f9fbff;
    border: 1px solid #e6ebf3;
    border-radius: 11px;
}

.meta-box span,
.meta-box strong {
    display: block;
}

.meta-box span {
    margin-bottom: 2px;
    color: var(--muted);
    font-size: .65rem;
    font-weight: 850;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.meta-box strong {
    overflow-wrap: anywhere;
    color: #26314b;
    font-size: .82rem;
}

/* ---------- Accesibilidad / interacción ---------- */
[aria-busy="true"] {
    cursor: progress;
}

button[disabled],
.btn.disabled,
.btn:disabled {
    cursor: not-allowed;
    opacity: .62;
    transform: none !important;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #df7083;
    background-color: #fffafb;
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #70bf8d;
    background-color: #fbfffc;
}

.invalid-feedback,
.valid-feedback {
    font-size: .72rem;
    font-weight: 650;
}

@media (prefers-reduced-motion: reduce) {
    .loading-skeleton::after,
    .skeleton-line::after,
    .skeleton-block::after {
        animation: none !important;
    }
}
