.autogestion-page {
    --ag-primary: #0659c7;
    --ag-primary-dark: #063b91;
    --ag-navy: #071c54;
    --ag-blue-soft: #eef8ff;
    --ag-blue-border: #a9d3fb;
    --ag-green: #2d9b32;
    --ag-green-soft: #edf9ee;
    --ag-text: #24324a;
    --ag-muted: #64748b;
    --ag-border: #dce4ed;
    --ag-shadow: 0 10px 30px rgba(25, 52, 94, 0.08);
    background: linear-gradient(180deg, #f8fbff 0, #fff 340px);
    color: var(--ag-text);
    min-height: calc(100vh - 84px);
    padding: 0 0 48px;
}

.autogestion-shell {
    max-width: 1320px;
}

.autogestion-page .module-header-block {
    margin-bottom: 24px;
}

.autogestion-page .module-breadcrumb ol {
    padding-top: 18px;
}

.autogestion-breadcrumb .breadcrumb {
    background: transparent;
    margin: 0;
    padding: 18px 0 8px;
}

.autogestion-breadcrumb a {
    color: var(--ag-muted);
}

.autogestion-breadcrumb a:hover {
    color: var(--ag-primary);
}

.autogestion-title {
    margin: 12px auto 28px;
    text-align: center;
}

.autogestion-title h1 {
    color: var(--ag-navy);
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 750;
    letter-spacing: -0.035em;
    line-height: 1.1;
    margin: 0;
}

.autogestion-title > p:last-child {
    color: var(--ag-muted);
    font-size: 1.05rem;
    margin: 10px 0 0;
}

.autogestion-eyebrow,
.autogestion-card-kicker {
    color: var(--ag-primary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    margin: 0 0 3px;
    text-transform: uppercase;
}

.autogestion-hero {
    align-items: center;
    background: linear-gradient(105deg, #e8f6ff 0%, #f7fbff 100%);
    border: 1px solid var(--ag-blue-border);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(0, 93, 190, 0.1);
    display: grid;
    gap: 24px;
    grid-template-columns: 220px minmax(300px, 1fr) auto;
    margin-bottom: 24px;
    min-height: 160px;
    overflow: hidden;
    padding: 18px 26px 18px 12px;
}

.autogestion-hero-visual {
    align-self: stretch;
    border-right: 1px solid rgba(6, 89, 199, 0.22);
    display: grid;
    place-items: center;
    padding-right: 18px;
}

.autogestion-hero-visual img {
    border-radius: 12px;
    height: 120px;
    max-width: 100%;
    object-fit: cover;
    width: 180px;
}

.autogestion-hero-copy {
    align-items: flex-start;
    display: flex;
    gap: 18px;
}

.autogestion-hero h2,
.autogestion-card h2 {
    color: var(--ag-navy);
    font-size: 1.42rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
}

.autogestion-hero-copy p {
    color: var(--ag-text);
    font-size: 1rem;
    line-height: 1.6;
    margin: 8px 0 0;
    max-width: 620px;
}

.autogestion-icon {
    align-items: center;
    border-radius: 12px;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 1.35rem;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.autogestion-icon-primary {
    background: var(--ag-primary);
    border-radius: 50%;
    color: #fff;
}

.autogestion-icon-soft {
    background: #e8f4ff;
    color: var(--ag-primary);
}

.autogestion-icon-success {
    background: var(--ag-green-soft);
    color: var(--ag-green);
}

.autogestion-btn-primary {
    background: linear-gradient(135deg, #0868dc, #064fb5);
    border: 0;
    border-radius: 9px;
    box-shadow: 0 8px 18px rgba(6, 89, 199, 0.2);
    color: #fff;
    font-weight: 650;
    padding: 14px 22px;
    white-space: nowrap;
}

.autogestion-btn-primary:hover,
.autogestion-btn-primary:focus {
    background: linear-gradient(135deg, #075fc9, #043d91);
    box-shadow: 0 10px 22px rgba(6, 89, 199, 0.28);
    color: #fff;
    transform: translateY(-1px);
}

.autogestion-btn-primary i {
    margin-right: 8px;
}

.autogestion-main-row {
    margin-bottom: 24px;
}

.autogestion-card {
    background: #fff;
    border: 1px solid var(--ag-border);
    border-radius: 14px;
    box-shadow: var(--ag-shadow);
    height: 100%;
    padding: 26px;
}

.autogestion-card-heading {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
}

.autogestion-card-heading p:not(.autogestion-card-kicker) {
    color: var(--ag-muted);
    margin: 4px 0 0;
}

.invoice-query-form label {
    color: var(--ag-text);
    font-weight: 650;
}

.autogestion-input-wrap {
    position: relative;
}

.autogestion-input-wrap .form-control {
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    font-size: 1rem;
    height: 56px;
    padding: 12px 46px 12px 15px;
}

.autogestion-input-wrap > i {
    color: #8290a4;
    font-size: 1.1rem;
    pointer-events: none;
    position: absolute;
    right: 17px;
    top: 19px;
}

.invoice-query-form .form-text {
    margin-top: 8px;
}

.invoice-query-form .recaptcha-component {
    margin: 24px 0 22px;
    min-height: 78px;
    overflow: hidden;
}

.autogestion-btn-block {
    display: block;
    width: 100%;
}

.autogestion-status {
    border-radius: 8px;
    font-size: 0.9rem;
    margin-top: 12px;
    min-height: 0;
    padding: 0;
}

.autogestion-status.is-success {
    background: var(--ag-green-soft);
    color: #226f27;
    padding: 10px 12px;
}

.autogestion-status.is-error {
    background: #fdecec;
    color: #8f2121;
    padding: 10px 12px;
}

.invoice-guide {
    align-items: stretch;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) 170px;
}

.help-card-reference {
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: hidden;
    padding: 0;
}

.help-card-reference > img {
    border-radius: 14px;
    display: block;
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.invoice-guide-document {
    background: #f8fbff;
    border: 1px solid #bfd0e3;
    border-radius: 10px;
    min-height: 290px;
    overflow: hidden;
    position: relative;
}

.invoice-guide-image {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.invoice-guide-brand {
    background: rgba(255, 255, 255, 0.94);
    border-radius: 4px;
    height: auto;
    left: 15px;
    padding: 5px;
    position: absolute;
    top: 15px;
    width: 86px;
    z-index: 2;
}

.invoice-code-marker {
    background: rgba(239, 251, 240, 0.96);
    border: 2px solid #44aa4a;
    border-radius: 7px;
    box-shadow: 0 3px 10px rgba(45, 155, 50, 0.16);
    color: #1c5220;
    display: flex;
    flex-direction: column;
    left: 46%;
    padding: 7px 13px;
    position: absolute;
    top: 10%;
    z-index: 2;
}

.invoice-code-marker span {
    font-size: 0.66rem;
    font-weight: 650;
}

.invoice-code-marker strong {
    font-size: 1.05rem;
    letter-spacing: 0.08em;
}

.invoice-guide-callout {
    align-items: center;
    background: var(--ag-green-soft);
    border: 1px solid #bee5c1;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 18px;
    position: relative;
    text-align: center;
}

.invoice-guide-callout p {
    font-size: 0.9rem;
    line-height: 1.45;
    margin: 13px 0 0;
}

.callout-arrow {
    color: var(--ag-green);
    font-size: 2rem;
    left: -28px;
    position: absolute;
    top: 48px;
}

.history-card {
    height: auto;
    padding: 0;
}

.history-card-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding: 20px 26px;
}

.history-toggle {
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: var(--ag-primary);
    height: 42px;
    transition: background 0.2s ease;
    width: 42px;
}

.history-toggle:hover,
.history-toggle:focus {
    background: var(--ag-blue-soft);
    outline: 0;
}

.history-content {
    border-top: 1px solid var(--ag-border);
    padding: 24px 26px 20px;
}

.consumption-chart {
    height: 260px;
    overflow: hidden;
    position: relative;
}

.chart-grid {
    background-image: linear-gradient(to bottom, #e7edf4 1px, transparent 1px);
    background-size: 100% 25%;
    bottom: 38px;
    left: 0;
    position: absolute;
    right: 0;
    top: 24px;
}

.chart-bars {
    align-items: flex-end;
    bottom: 0;
    display: flex;
    gap: clamp(10px, 4vw, 46px);
    height: 100%;
    justify-content: space-around;
    left: 0;
    padding: 24px 30px 0;
    position: absolute;
    right: 0;
}

.chart-item {
    align-items: center;
    display: flex;
    flex: 1;
    flex-direction: column;
    height: 100%;
    justify-content: flex-end;
    max-width: 92px;
}

.chart-value {
    color: var(--ag-muted);
    font-size: 0.76rem;
    margin-bottom: 6px;
}

.chart-bar {
    background: linear-gradient(180deg, #1ba5e8, #075bc5);
    border-radius: 7px 7px 0 0;
    box-shadow: 0 8px 14px rgba(6, 89, 199, 0.14);
    height: var(--bar-height);
    min-height: 24px;
    transition: height 0.45s ease;
    width: min(56px, 80%);
}

.chart-label {
    color: var(--ag-text);
    font-size: 0.85rem;
    font-weight: 650;
    height: 38px;
    padding-top: 10px;
}

.history-actions {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

.history-actions p {
    color: var(--ag-muted);
    font-size: 0.85rem;
    margin: 0;
}

.history-link {
    color: var(--ag-primary);
    font-weight: 650;
}

.history-link:hover {
    color: var(--ag-primary-dark);
}

@media (max-width: 991.98px) {
    .autogestion-hero {
        grid-template-columns: 160px minmax(0, 1fr);
    }

    .autogestion-hero-visual img {
        height: 105px;
        width: 125px;
    }

    .autogestion-hero > .autogestion-btn-primary {
        grid-column: 2;
        justify-self: start;
    }

    .query-card {
        min-height: auto;
    }
}

@media (max-width: 767.98px) {
    .autogestion-page {
        padding-bottom: 24px;
    }

    .autogestion-title {
        margin-bottom: 22px;
        text-align: left;
    }

    .autogestion-title h1 {
        font-size: 2rem;
    }

    .autogestion-hero {
        display: flex;
        flex-direction: column;
        padding: 20px;
        text-align: center;
    }

    .autogestion-hero-visual {
        border-bottom: 1px solid rgba(6, 89, 199, 0.18);
        border-right: 0;
        padding: 0 0 16px;
        width: 100%;
    }

    .autogestion-hero-copy {
        align-items: center;
        flex-direction: column;
    }

    .autogestion-hero > .autogestion-btn-primary {
        width: 100%;
    }

    .autogestion-card {
        padding: 20px;
    }

    .help-card-reference {
        padding: 0;
    }

    .invoice-guide {
        grid-template-columns: 1fr;
    }

    .invoice-guide-callout {
        flex-direction: row;
        gap: 12px;
        text-align: left;
    }

    .invoice-guide-callout p {
        margin: 0;
    }

    .callout-arrow {
        left: 50%;
        top: -25px;
        transform: rotate(90deg);
    }

    .history-card {
        padding: 0;
    }

    .history-card-heading,
    .history-content {
        padding-left: 18px;
        padding-right: 18px;
    }

    .history-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .history-link {
        padding-left: 0;
    }

    .chart-bars {
        gap: 8px;
        padding-left: 4px;
        padding-right: 4px;
    }
}

@media (max-width: 380px) {
    .invoice-query-form .g-recaptcha {
        transform: scale(0.88);
        transform-origin: left top;
    }

    .invoice-query-form .recaptcha-component {
        min-height: 70px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .autogestion-page *,
    .autogestion-page *::before,
    .autogestion-page *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
