/* =========================================================
   Style strony: recurring-invoices
   Wyeksportowane z bloku <style> w pliku recurring-invoices.html
========================================================= */

    /* ---- ikonka powrotu obok tytulu strony ---- */
    .dash-title-wrap {
        display: flex;
        align-items: center; /* strzalka "wstecz" na wysokosci tytulu */
        gap: 14px;
        margin-bottom: 4px;
    }

    .dash-title-wrap .dash-greeting {
        margin-bottom: 0;
    }

    .dash-header-main {
        min-width: 0;
    }

    .dash-back {
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        border-radius: 10px;
        background: #e8f0fe;
        color: #3473BA;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        text-decoration: none;
        transition: background .15s ease, color .15s ease;
    }

    .dash-back:hover,
    .dash-back:focus-visible {
        background: #d3e3f7;
        color: #24528a;
    }

    /* ogolna instrukcja pod naglowkiem - przycisk po prawej, rozwijany opis pod nim */
    /* ---- przypisane oddzialy pod naglowkiem ---- */
    .branch-summary {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        margin-top: 10px;
    }

    .branch-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 5px 10px;
        border: 1px solid var(--dash-border);
        border-radius: 8px;
        background: #fff;
        font-size: .78rem;
        color: var(--dash-ink);
        white-space: nowrap;
    }

    .branch-chip i {
        color: #3473BA;
        font-size: .85rem;
    }

    .branch-chip.is-name {
        font-weight: 600;
        background: #e8f0fe;
        border-color: #d3e3f7;
    }

    /* prawa kolumna naglowka: data u gory, przycisk "Instrukcja" wyrownany do dolu,
       czyli do poziomu chipow z oddzialami */
    .dash-header-side {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: space-between;
        align-self: stretch;
        gap: 12px;
    }

    /* panel instrukcji rozwija sie pod calym naglowkiem; zwiniety nie zostawia odstepu */
    .page-help .billing-help {
        margin: 0 0 20px;
    }

    /* przycisk odswiezania sekcji - wyglad jak "Instrukcja" */
    .billing-refresh-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 7px 12px;
        background: #fff;
        border: 1px solid #cfeadb;
        border-radius: 10px;
        font-size: .78rem;
        font-weight: 600;
        line-height: 1.1;
        color: #2e7d4f;
        transition: background .18s ease, border-color .18s ease;
    }

    .billing-refresh-btn:hover,
    .billing-refresh-btn:focus-visible {
        background: #e2f3e8;
        border-color: #2e7d4f;
        outline: none;
    }

    .billing-refresh-btn small {
        font-size: .68rem;
        font-weight: 500;
        color: #6b7a90;
    }

    .billing-refresh-btn i {
        font-size: .9rem;
    }

    /* w rzedzie licznika przycisk stoi po lewej, zaraz za licznikiem;
       ma te sama wysokosc co pigulka licznika i stala szerokosc w kazdej sekcji */
    .billing-single .billing-refresh-btn {
        align-self: stretch;
        justify-content: center;
        min-width: 136px;
        border-radius: 12px;
    }

    .billing-refresh-btn.is-loading {
        pointer-events: none;
    }

    .billing-refresh-btn.is-loading i {
        animation: billing-refresh-spin .7s linear infinite;
    }

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

    html[data-bs-theme="dark"] .billing-refresh-btn {
        background: #163a2a;
        border-color: #2a5a40;
        color: #8fd8ae;
    }

    html[data-bs-theme="dark"] .billing-refresh-btn:hover,
    html[data-bs-theme="dark"] .billing-refresh-btn:focus-visible {
        background: #1d4a35;
        border-color: #8fd8ae;
    }

    html[data-bs-theme="dark"] .billing-refresh-btn small {
        color: #9fb0c9;
    }

    @media (max-width: 767.98px) {
        .dash-header-side {
            width: 100%;
            align-items: stretch;
        }

        .dash-header-side .billing-help-group {
            align-self: flex-end;
        }
    }

    /* ---- cztery panele fakturowania jeden pod drugim, kazdy na cala szerokosc ---- */
    .billing-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
        align-items: stretch;
        margin-bottom: 20px;
    }

    .billing-row > .billing-panel {
        display: flex;
        flex-direction: column;
        margin-bottom: 0;
    }

    /* stonowane kolory przyciskow sterowania: niebieski, zielony, pomaranczowy, czerwony */
    .billing-btn.is-info {
        background: #e3eefb;
        color: #2f66a8;
    }

    .billing-btn.is-info:hover {
        background: #d3e3f7;
        color: #24528a;
    }

    .billing-btn.is-success {
        background: #e2f3e8;
        color: #2e7d4f;
    }

    .billing-btn.is-success:hover {
        background: #cfeadb;
        color: #23663f;
    }

    .billing-btn.is-danger {
        background: #fbe4e4;
        color: #b93038;
    }

    .billing-btn.is-danger:hover {
        background: #f6d2d2;
        color: #9c262d;
    }

    html[data-bs-theme="dark"] .billing-btn.is-info {
        background: #16304d;
        border-color: transparent;
        color: #8fb5e0;
    }

    html[data-bs-theme="dark"] .billing-btn.is-success {
        background: #163a2a;
        border-color: transparent;
        color: #8fd8ae;
    }

    html[data-bs-theme="dark"] .billing-btn.is-danger {
        background: #46201f;
        border-color: transparent;
        color: #f0a2a2;
    }

    html[data-bs-theme="dark"] .billing-btn.is-warn {
        border-color: transparent;
    }

    /* naglowek panelu: tytul w pierwszym wierszu, data i "Instrukcja" pod nim */
    .billing-row .billing-panel-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .billing-row .billing-head-tools {
        width: 100%;
    }

    /* "Instrukcja" dosunieta do prawej krawedzi, data zostaje po lewej */
    .billing-row .billing-head-tools .billing-help-group {
        margin-left: auto;
    }

    /* licznik u gory, przyciski przy dolnej krawedzi panelu */
    .billing-row .billing-single {
        flex: 1 1 auto;
        align-content: space-between;
    }

    .billing-row .billing-single .billing-actions {
        flex: 1 0 100%;
        margin-left: 0;
        padding-top: 18px;
    }

    /* cztery przyciski sterowania: wszystkie w jednym rzedzie, rowne szerokosci */
    .billing-row .billing-single .billing-actions {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .billing-row .billing-single .billing-actions .billing-btn {
        justify-content: center;
        padding-left: 8px;
        padding-right: 8px;
        text-align: center;
        line-height: 1.2;
        white-space: normal;
    }

    .billing-row .billing-single .billing-actions .billing-btn > .bi {
        flex: 0 0 auto;
    }


    .billing-list .issue-list {
        margin-top: 16px;
        margin-bottom: 0;
    }

    /* naglowek listy: przelacznik "Pokaz: 10 / 20" + licznik wyswietlonych pozycji */
    .issue-list-tools {
        display: flex;
        align-items: center;
        gap: 14px;
    }

    .issue-page-size {
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

    .issue-page-size-label {
        font-size: .75rem;
        color: var(--dash-muted);
        margin-right: 2px;
    }

    .issue-page-btn {
        min-width: 34px;
        padding: 4px 8px;
        border: 1px solid var(--dash-border);
        border-radius: 8px;
        background: #fff;
        color: var(--dash-ink);
        font-size: .75rem;
        font-weight: 600;
        line-height: 1.2;
        transition: background .15s ease, border-color .15s ease, color .15s ease;
    }

    .issue-page-btn:hover {
        border-color: #3473BA;
        color: #3473BA;
    }

    .issue-page-btn.is-active {
        background: #e8f0fe;
        border-color: #3473BA;
        color: #3473BA;
    }

    /* na tablecie po dwa w rzedzie, na telefonie jeden pod drugim */
    @media (max-width: 991.98px) {
        .billing-row .billing-single .billing-actions {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    @media (max-width: 575.98px) {
        .billing-row .billing-single .billing-actions {
            grid-template-columns: minmax(0, 1fr);
        }
    }


    /* ---- okno "Wyslij powiadomienie" ---- */
    .notify-modal .modal-content {
        border: 0;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 18px 50px rgba(15, 23, 42, .18);
    }

    .notify-modal .modal-content > form {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .notify-modal .modal-body {
        padding: 18px 22px 8px;
    }

    .notify-header {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 18px 22px;
        border-bottom: 1px solid #eef2f7;
        background: linear-gradient(135deg, #fff7ec 0%, #ffffff 60%);
    }

    .notify-header-icon {
        flex: 0 0 46px;
        width: 46px;
        height: 46px;
        border-radius: 14px;
        background: #E0912F;
        color: #fff;
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 8px 18px rgba(224, 145, 47, .28);
    }

    .notify-header .modal-title {
        margin: 0;
        font-size: 17px;
        font-weight: 700;
        color: #111827;
    }

    .notify-sub {
        margin: 2px 0 0;
        font-size: 13px;
        color: #6b7a90;
    }

    .notify-header .btn-close {
        margin-left: auto;
    }

    .notify-modal .form-label {
        margin-bottom: 6px;
        font-size: 13px;
        font-weight: 600;
        color: #6b7280;
    }

    .notify-modal .req {
        color: #d9534f;
    }

    .notify-block {
        margin-bottom: 14px;
    }

    .notify-block-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .notify-count {
        font-size: 12px;
        font-weight: 600;
        color: #3473BA;
    }

    .notify-recipients {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px 12px;
        border: 1px solid var(--dash-border);
        border-radius: 12px;
        background: #fbfcfe;
        min-height: 46px;
    }

    .notify-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 4px 10px;
        border-radius: 999px;
        background: #e8f0fe;
        color: #2f5f9e;
        font-size: 12px;
        font-weight: 600;
    }

    .notify-chip small {
        font-weight: 500;
        color: #6b7a90;
    }

    .notify-empty {
        font-size: 12.5px;
        color: #93a0b3;
    }

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

    .notify-field {
        margin-bottom: 14px;
    }

    .notify-hint {
        margin: 6px 0 0;
        font-size: 12px;
        color: #93a0b3;
    }

    .notify-hint code {
        font-size: 11.5px;
        color: #3473BA;
    }

    .notify-check {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 10px;
        font-size: 13px;
        color: #4b5563;
        cursor: pointer;
    }

    .notify-check input {
        width: 16px;
        height: 16px;
        accent-color: #3473BA;
    }

    .notify-error {
        margin: 0 0 10px;
        font-size: 13px;
        font-weight: 600;
        color: #d9534f;
    }

    .notify-footer {
        gap: 8px;
        padding: 12px 22px 20px;
        border-top: 1px solid #eef2f7;
    }

    .notify-footer .notify-submit {
        margin-left: auto;
    }

    @media (max-width: 575.98px) {
        .notify-grid {
            grid-template-columns: minmax(0, 1fr);
        }
    }

    /* ciemny motyw */
    html[data-bs-theme="dark"] .notify-header {
        background: linear-gradient(135deg, #2a2114 0%, #131c2e 60%);
        border-color: #263349;
    }

    html[data-bs-theme="dark"] .notify-header .modal-title { color: #e6edf7; }
    html[data-bs-theme="dark"] .notify-sub,
    html[data-bs-theme="dark"] .notify-check,
    html[data-bs-theme="dark"] .notify-modal .form-label { color: #9fb0c9; }

    html[data-bs-theme="dark"] .notify-recipients {
        background: #101a2b;
        border-color: #2c3a54;
    }

    html[data-bs-theme="dark"] .notify-chip {
        background: #1c2a45;
        color: #9cc4f5;
    }

    html[data-bs-theme="dark"] .notify-footer { border-color: #263349; }

    /* ---------- okno odswiezania sekcji ---------- */
    .refresh-header {
        background: linear-gradient(135deg, #f4f8fe 0%, #ffffff 60%);
    }

    .refresh-header-icon {
        background: transparent;
        border: 2px solid #1F4E8C;
        color: #1F4E8C;
        box-shadow: none;
    }

    html[data-bs-theme="dark"] .refresh-header-icon {
        border-color: #6FA3E0;
        color: #6FA3E0;
    }

    .refresh-modal.is-running .refresh-header-icon i {
        display: inline-block;
        animation: billing-refresh-spin 1s linear infinite;
    }

    .refresh-progress-head {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 8px;
    }

    .refresh-progress-label {
        font-size: 13px;
        font-weight: 600;
        color: #33475b;
    }

    .refresh-progress-pct {
        font-size: 15px;
        font-weight: 700;
        color: #3473BA;
        font-variant-numeric: tabular-nums;
    }

    .refresh-progress {
        height: 10px;
        border-radius: 999px;
        background: #e8eef7;
        overflow: hidden;
    }

    .refresh-progress-fill {
        height: 100%;
        border-radius: 999px;
        background: linear-gradient(90deg, #3473BA, #5b9bea);
        transition: width .45s ease;
    }

    .refresh-modal.is-done .refresh-progress-fill {
        background: linear-gradient(90deg, #2e9e5b, #5cb85c);
    }

    .refresh-steps {
        list-style: none;
        margin: 16px 0 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .refresh-steps li {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 13px;
        color: #93a0b3;
        transition: color .2s ease;
    }

    .refresh-steps li i {
        font-size: 15px;
        width: 18px;
        text-align: center;
    }

    .refresh-steps li.is-active {
        color: #1f2937;
        font-weight: 600;
    }

    .refresh-steps li.is-active i {
        color: #3473BA;
        animation: billing-refresh-spin 1s linear infinite;
    }

    .refresh-steps li.is-done {
        color: #4b5563;
    }

    .refresh-steps li.is-done i {
        color: #2e9e5b;
    }

    .refresh-result {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-top: 16px;
        padding: 10px 12px;
        border: 1px solid #bfe3cc;
        border-radius: 12px;
        background: #f2fbf5;
        font-size: 13px;
        font-weight: 600;
        color: #1f7a42;
        animation: refresh-result-in .25s ease;
    }

    .refresh-result i {
        font-size: 18px;
        color: #2e9e5b;
    }

    @keyframes refresh-result-in {
        from { opacity: 0; transform: translateY(6px); }
        to { opacity: 1; transform: none; }
    }

    .refresh-footer {
        justify-content: space-between;
    }

    .refresh-note {
        font-size: 12.5px;
        color: #6b7a90;
    }

    html[data-bs-theme="dark"] .refresh-header {
        background: linear-gradient(135deg, #16223a 0%, #131c2e 60%);
    }

    html[data-bs-theme="dark"] .refresh-progress { background: #22304d; }
    html[data-bs-theme="dark"] .refresh-progress-label { color: #c9d5e6; }
    html[data-bs-theme="dark"] .refresh-steps li.is-active { color: #e6edf7; }
    html[data-bs-theme="dark"] .refresh-steps li.is-done { color: #9fb0c9; }
    html[data-bs-theme="dark"] .refresh-note { color: #9fb0c9; }

    html[data-bs-theme="dark"] .refresh-result {
        background: #14261d;
        border-color: #245c3a;
        color: #8fd4a8;
    }
