:root {
    --primary: #c9131f;
    --primary-dark: #9f0d18;
    --primary-light: #fff0f1;
    --sidebar-bg: #33262a;
    --sidebar-active: #5a2028;
    --text: #3f3134;
    --text-muted: #80676c;
    --border: #ead0d4;
    --background: #fff7f8;
    --success: #1d7b34;
    --danger: #d80016;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.app-container[hidden] {
    display: none;
}

.sidebar {
    width: 200px;
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.brand {
    padding: 20px;
    background: var(--primary);
    text-align: center;
}

.brand-logo {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.brand-subtitle {
    font-size: 12px;
    opacity: 0.8;
}

.nav {
    flex: 1;
    padding: 10px 0;
}

.nav-button {
    width: 100%;
    padding: 12px 20px;
    background: none;
    border: none;
    color: #ced6de;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: background 0.2s;
}

.nav-button:hover {
    background: var(--sidebar-active);
}

.nav-button.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left: 4px solid var(--primary);
}

.nav-icon {
    font-size: 18px;
}

.nav-label {
    flex: 1;
}

.server-info {
    padding: 20px;
    text-align: center;
}

.server-badge {
    background: var(--primary);
    color: #fff;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--primary-light);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    color: var(--primary);
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.server-status {
    background: var(--primary);
    color: #fff;
    padding: 5px 15px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.content {
    flex: 1;
    padding: 30px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h2 {
    font-size: 20px;
    color: var(--text);
}

.client-counter {
    color: var(--text-muted);
    font-size: 14px;
}

.search-container {
    margin-bottom: 20px;
}

#client-search {
    width: 100%;
    max-width: 400px;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 14px;
    color: var(--text);
}

#client-search:focus {
    outline: 2px solid var(--primary);
    border-color: var(--primary);
}

.dashboard-header {
    text-align: center;
    margin-bottom: 30px;
}

.dashboard-header h2 {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
}

.table-container {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--primary-light);
}

.data-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: bold;
    color: var(--text);
    border-bottom: 2px solid var(--primary);
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: var(--primary-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-style: italic;
}

.stat-card[data-page]:hover {
    border-color: var(--primary);
}

/* =========================================================
   KLIENCI - widok kartoteki
   ========================================================= */

#page-clients {
    max-width: 1600px;
    margin: 0 auto;
}

/* Naglowek modulu */

.clients-hero {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 18px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 1px 3px rgba(63, 49, 52, 0.04);
}

.clients-hero-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.clients-hero-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.clients-hero h2 {
    margin: 0 0 2px;
    color: var(--text);
    font-size: 20px;
    line-height: 1.25;
}

.clients-hero p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}

.primary-button {
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    min-height: 38px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(159, 13, 24, 0.18);
}

.primary-button:hover {
    background: var(--primary-dark);
}


.primary-button span {
    font-size: 19px;
    line-height: 1;
    font-weight: 400;
}

/* Panel wyszukiwania i filtrow */

.clients-filters {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 16px 18px 13px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(63, 49, 52, 0.04);
}

.filters-main-row {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 190px 170px;
    gap: 12px;
    align-items: end;
}

.filter-field {
    min-width: 0;
}

.filter-field label {
    display: block;
    margin: 0 0 5px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-field input,
.filter-field select {
    width: 100%;
    height: 38px;
    border: 1px solid #dcc5c9;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    padding: 0 11px;
    font-family: inherit;
    font-size: 13px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-field input::placeholder {
    color: #a58e92;
}

.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(201, 19, 31, 0.09);
}

.filter-field select:disabled {
    background: #f7f2f3;
    color: #ad9a9e;
    cursor: not-allowed;
}

/* Szybkie filtry */

.quick-filters-row {
    border-top: 1px solid #f0e2e4;
    margin-top: 14px;
    padding-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.quick-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.quick-filters-label {
    color: var(--text-muted);
    font-size: 12px;
    margin-right: 2px;
}

.filter-chip {
    border: 1px solid #e2cdd0;
    background: #fff;
    color: #685257;
    border-radius: 15px;
    padding: 5px 10px;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.filter-chip:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.filter-chip.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.filter-chip:disabled,
.filter-chip-pending {
    opacity: 0.48;
    cursor: not-allowed;
}

.client-results-count {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.client-results-count strong {
    color: var(--primary);
    font-size: 14px;
}

/* Tabela klientow */

.clients-table-container {
    overflow-x: auto;
    border-radius: 9px;
}

.clients-table {
    min-width: 1120px;
    font-size: 12px;
}

.clients-table th {
    padding: 10px 9px;
    white-space: nowrap;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.clients-table td {
    padding: 9px;
    vertical-align: middle;
}

.clients-table .select-column {
    width: 38px;
    text-align: center;
}

.clients-table .actions-column {
    width: 108px;
}

.clients-table .policies-column {
    width: 60px;
    text-align: center;
}

.clients-table input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}

.client-name {
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.client-subtype {
    color: var(--text-muted);
    font-size: 10px;
    margin-top: 1px;
}

.client-type-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 11px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.client-type-badge.person {
    background: #fff0f1;
    color: var(--primary);
    border: 1px solid #f0c8cc;
}

.client-type-badge.company {
    background: #f3f0f1;
    color: #5e4b4f;
    border: 1px solid #ddd1d3;
}

/* Przyciski akcji */

.client-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.icon-button {
    width: 27px;
    height: 27px;
    padding: 0;
    border: 1px solid #e1ced1;
    border-radius: 5px;
    background: #fff;
    color: #765d62;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-button svg {
    width: 14px;
    height: 14px;
}

.icon-button:disabled {
    opacity: 0.62;
    cursor: default;
}

.unavailable-value {
    color: #a58e92;
}

/* Lepszy hover tylko dla tabeli klientow */

.clients-table tbody tr {
    transition: background 0.12s;
}

.clients-table tbody tr:hover {
    background: #fff5f6;
}

/* Responsywnosc */

@media (max-width: 1050px) {
    .filters-main-row {
        grid-template-columns: 1fr 170px;
    }

    .filter-search {
        grid-column: 1 / -1;
    }

    .quick-filters-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .content {
        padding: 18px;
    }

    .clients-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .primary-button {
        width: 100%;
    }

    .filters-main-row {
        grid-template-columns: 1fr;
    }

    .filter-search {
        grid-column: auto;
    }

    .quick-filters {
        align-items: flex-start;
    }
}

/* KLIENCI - korekta szerokiego ukladu filtrow */
@media (min-width: 1051px) {
    .filters-main-row {
        grid-template-columns: minmax(500px, 1fr) 170px 155px;
    }

    .filter-search input {
        width: 100%;
        max-width: none;
    }
}

/* KLIENCI - liczba polis */
.policy-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 25px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    background: var(--primary-light);
    border: 1px solid #f0c8cc;
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
}

/* KLIENCI - status aktywnej polisy */
.client-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 11px;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.client-status-badge.active {
    background: #edf8f0;
    border: 1px solid #b9dfc2;
    color: #1d7b34;
}

.client-status-badge.inactive {
    background: #f3f0f1;
    border: 1px solid #ddd1d3;
    color: #80676c;
}


/* ============================================================
   KARTA KLIENTA 360
   ============================================================ */

.client360-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.client360-back-row {
    display: flex;
    align-items: center;
}

.client360-back-button {
    border: 1px solid #ded4d6;
    background: #fff;
    color: #5f4c50;
    border-radius: 8px;
    padding: 8px 13px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.client360-back-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.client360-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 22px;
    background: #fff;
    border: 1px solid #eadfe1;
    border-radius: 12px;
}

.client360-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--primary-light);
    border: 1px solid #efc7cc;
    color: var(--primary);
    font-size: 19px;
    font-weight: 800;
}

.client360-heading {
    min-width: 0;
    flex: 1;
}

.client360-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: var(--primary);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.1px;
}

.client360-heading h2 {
    margin: 0;
    color: #2d2426;
    font-size: 22px;
    line-height: 1.2;
}

.client360-heading p {
    margin: 5px 0 0;
    color: #8b7a7d;
    font-size: 12px;
}

.client360-hero-status {
    margin-left: auto;
}

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

.client360-stat {
    display: flex;
    flex-direction: column;
    min-height: 92px;
    padding: 15px 17px;
    background: #fff;
    border: 1px solid #eadfe1;
    border-radius: 10px;
}

.client360-stat span {
    color: #806f72;
    font-size: 11px;
    font-weight: 600;
}

.client360-stat strong {
    margin-top: 5px;
    color: #302527;
    font-size: 24px;
    line-height: 1;
}

.client360-stat small {
    margin-top: auto;
    padding-top: 8px;
    color: #a29295;
    font-size: 9px;
}

.client360-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.7fr) minmax(520px, 1.7fr);
    gap: 14px;
    align-items: start;
}

.client360-card {
    background: #fff;
    border: 1px solid #eadfe1;
    border-radius: 11px;
    overflow: hidden;
}

.client360-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eee5e7;
}

.client360-card-title h3 {
    margin: 0;
    color: #33282a;
    font-size: 14px;
}

.client360-card-title p {
    margin: 3px 0 0;
    color: #9b898c;
    font-size: 10px;
}

.client360-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 4px 16px 14px;
}

.client360-details > div {
    min-width: 0;
    padding: 12px 8px 10px 0;
    border-bottom: 1px solid #f2ecee;
}

.client360-details .client360-detail-wide {
    grid-column: 1 / -1;
}

.client360-details dt {
    margin-bottom: 4px;
    color: #9b898c;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .35px;
}

.client360-details dd {
    margin: 0;
    color: #3a2f31;
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

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

.client360-policy-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.client360-policy-table th {
    padding: 9px 10px;
    background: #faf7f8;
    border-bottom: 1px solid #e9dfe1;
    color: #806f72;
    text-align: left;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.client360-policy-table td {
    padding: 11px 10px;
    border-bottom: 1px solid #f0e8ea;
    color: #45383b;
    vertical-align: middle;
}

.client360-policy-table tbody tr:last-child td {
    border-bottom: 0;
}

.client360-policy-table tbody tr:hover {
    background: #fdfafb;
}

.client360-period-separator {
    margin: 0 3px;
    color: #b7a8aa;
}

.client360-empty {
    padding: 28px !important;
    color: #9b898c !important;
    text-align: center;
}

.client-view-button:not(:disabled) {
    cursor: pointer;
}

.client-view-button:not(:disabled):hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

@media (max-width: 1050px) {
    .client360-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .client360-hero {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .client360-hero-status {
        width: 100%;
        margin-left: 76px;
    }

    .client360-stats {
        grid-template-columns: 1fr;
    }

    .client360-details {
        grid-template-columns: 1fr;
    }

    .client360-details .client360-detail-wide {
        grid-column: auto;
    }
}



/* ==========================================================
   KARTA KLIENTA 360 - ZAKLADKI
   ========================================================== */

.client360-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    padding: 0 8px;
    background: #ffffff;
    border: 1px solid #eadfe0;
    border-radius: 12px;
    min-height: 54px;
    scrollbar-width: thin;
}

.client360-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 52px;
    padding: 0 15px;
    border: 0;
    background: transparent;
    color: #6d5b5d;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.client360-tab:hover {
    color: #c8102e;
    background: #fff7f8;
}

.client360-tab.active {
    color: #c8102e;
    font-weight: 700;
}

.client360-tab.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: #c8102e;
}

.client360-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    border-radius: 999px;
    background: #f4e8ea;
    color: #8f2636;
    font-size: 11px;
    font-weight: 700;
}

.client360-tab.active .client360-tab-count {
    background: #c8102e;
    color: #ffffff;
}

@media (max-width: 1050px) {
    .client360-tabs {
        justify-content: flex-start;
    }

    .client360-tab {
        padding-left: 12px;
        padding-right: 12px;
    }
}


/* KARTA KLIENTA 360 - PANELE ZAKLADEK */

.client360-tab-panel {
    display: none;
}

.client360-tab-panel.active {
    display: block;
}

.client360-tab-panel[data-client360-panel="overview"].active {
    display: block;
}

.client360-tab-panel[data-client360-panel="overview"] .client360-stats {
    margin-top: 0;
}

.client360-details-full-card {
    margin-top: 0;
}

.client360-details-title p {
    margin: 4px 0 0;
    color: #8a7477;
    font-size: 12px;
    font-weight: 400;
}

.client360-details-full {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 24px;
}

.client360-details-full > div {
    min-width: 0;
}

.client360-details-full .client360-detail-wide {
    grid-column: span 2;
}

@media (max-width: 1050px) {
    .client360-details-full {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .client360-details-full {
        grid-template-columns: 1fr;
    }

    .client360-details-full .client360-detail-wide {
        grid-column: auto;
    }
}


/* KARTA KLIENTA 360 - PELNA LISTA POLIS */

.client360-policies-full-card {
    margin-top: 0;
}

.client360-policies-full-title p {
    margin: 4px 0 0;
    color: #8a7477;
    font-size: 12px;
    font-weight: 400;
}

.client360-policy-table-full {
    width: 100%;
}

.client360-policy-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: #b80f2b;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
}

.client360-policy-link:hover {
    text-decoration: underline;
}


/* ==========================================================
   KARTA POLISY - ETAP 1
   ========================================================== */

.policy-detail-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.policy-detail-back-row {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
}

.policy-detail-back-row > button {
    flex-shrink: 0;
    min-height: 38px;
    white-space: nowrap;
}

.policy-detail-back-button {
    border: 0;
    background: transparent;
    padding: 4px 0;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    color: #555;
}

.policy-detail-back-button:hover {
    text-decoration: underline;
}

.policy-detail-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 14px;
}

.policy-detail-icon {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 58px;
    border-radius: 14px;
    background: #f5f5f5;
    font-size: 28px;
}

.policy-detail-heading {
    flex: 1;
    min-width: 0;
}

.policy-detail-heading h2 {
    margin: 3px 0;
    font-size: 24px;
}

.policy-detail-heading p {
    margin: 0;
    color: #777;
}

.policy-detail-eyebrow {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    color: #888;
}

.policy-detail-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.policy-detail-status.active {
    background: #e7f6ec;
    color: #24763c;
}

.policy-detail-status.inactive {
    background: #f1f1f1;
    color: #666;
}

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

.policy-detail-stat,
.policy-detail-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 14px;
}

.policy-detail-stat {
    padding: 17px;
}

.policy-detail-stat span {
    display: block;
    margin-bottom: 7px;
    font-size: 12px;
    color: #777;
}

.policy-detail-stat strong {
    display: block;
    font-size: 16px;
    overflow-wrap: anywhere;
}

.policy-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 16px;
}

.policy-detail-card {
    padding: 20px;
}

.policy-detail-card-title {
    margin-bottom: 16px;
}

.policy-detail-card-title h3 {
    margin: 0;
}

.policy-detail-data {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 22px;
    margin: 0;
}

.policy-detail-data div {
    min-width: 0;
}

.policy-detail-data dt {
    margin-bottom: 4px;
    font-size: 12px;
    color: #777;
}

.policy-detail-data dd {
    margin: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.policy-detail-wide {
    grid-column: 1 / -1;
}

@media (max-width: 1050px) {
    .policy-detail-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .policy-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .policy-detail-hero {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .policy-detail-hero-status {
        width: 100%;
    }

    .policy-detail-stats {
        grid-template-columns: 1fr;
    }

    .policy-detail-data {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   KARTA POLISY - ETAP 2 - PRZEDMIOT UBEZPIECZENIA
   ========================================================== */

.policy-detail-subject-card {
    grid-column: 1 / -1;
}

.policy-detail-subject-card[hidden] {
    display: none;
}

.policy-detail-card-subtitle {
    margin: 5px 0 0;
    font-size: 13px;
    color: #6b7280;
}

.policy-detail-subject-card .policy-detail-data {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.policy-detail-subject-card
.policy-detail-data
.policy-detail-wide {
    grid-column: span 2;
}

@media (max-width: 1050px) {
    .policy-detail-subject-card .policy-detail-data {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .policy-detail-subject-card .policy-detail-data {
        grid-template-columns: 1fr;
    }

    .policy-detail-subject-card
    .policy-detail-data
    .policy-detail-wide {
        grid-column: auto;
    }
}


/* ==========================================================
   KARTA POLISY - ETAP 3
   ========================================================== */

.policy-detail-data > div[hidden] {
    display: none;
}


/* KARTA POLISY - ETAP UI */

.policy-detail-card[hidden],
.policy-detail-data > div[hidden] {
    display: none;
}


/* ==========================================================
   KARTA POLISY - DOKUMENTY
   ========================================================== */

.policy-detail-documents-card {
    margin-top: 20px;
}

.policy-detail-card-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: #777;
}

.policy-documents-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    border-radius: 15px;
    background: #f1f2f4;
    font-size: 13px;
    font-weight: 700;
}

.policy-documents-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.policy-document-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background: #fff;
}

.policy-document-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #f5f5f5;
    font-size: 12px;
    font-weight: 800;
}

.policy-document-main {
    min-width: 0;
    flex: 1;
}

.policy-document-name {
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.policy-document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 5px;
    font-size: 12px;
    color: #777;
}

.policy-document-status {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 6px;
    background: #f4f4f4;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.policy-document-open {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 1px solid #cfd4dc;
    border-radius: 6px;
    color: #24364b;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.policy-document-open:hover,
.policy-document-open:focus-visible {
    border-color: #75869b;
    background: #f4f7fa;
}

.policy-documents-empty {
    padding: 22px;
    border: 1px dashed #d8d8d8;
    border-radius: 10px;
    text-align: center;
    font-size: 13px;
    color: #777;
}

.policy-documents-error {
    color: #a32626;
}

@media (max-width: 700px) {
    .policy-document-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .policy-document-status {
        margin-left: 58px;
    }

    .policy-document-open {
        margin-left: 58px;
    }
}



/* Policy detail - insured people */

.policy-detail-insured-section[hidden] {
    display: none;
}

.policy-detail-insured-section {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e5e5e5;
}

.policy-detail-insured-heading h4 {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.policy-detail-insured-heading h4 span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    background: #f1f2f4;
    font-size: 12px;
    letter-spacing: 0;
}

.policy-insured-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.policy-insured-person {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0;
}

.policy-insured-avatar {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: rgba(128, 128, 128, 0.12);
}

.policy-insured-person-data {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.policy-insured-person-data strong {
    font-size: 13px;
}

.policy-insured-person-data span {
    font-size: 12px;
    opacity: 0.72;
}

/* Policy create form (preview only) */

.policy-form-page {
    max-width: 1120px;
    margin: 0 auto;
}

.policy-form-header {
    align-items: flex-start;
}

.policy-form-header p {
    margin: 5px 0 0;
    color: #777;
    font-size: 13px;
}

.policy-create-form {
    display: grid;
    gap: 16px;
}

.policy-form-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(63, 49, 52, 0.04);
}

.policy-form-card h3 {
    margin: 0 0 16px;
    font-size: 17px;
}

.policy-form-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.policy-form-card-heading h3 {
    margin: 0;
}

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

.policy-form-grid[hidden] {
    display: none;
}

.policy-form-grid label,
.policy-form-insured-row label {
    display: grid;
    gap: 5px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.policy-form-grid label > span {
    color: var(--primary);
}

.policy-form-grid input,
.policy-form-grid select,
.policy-form-insured-row input {
    width: 100%;
    min-height: 38px;
    box-sizing: border-box;
    border: 1px solid #dcc5c9;
    border-radius: 6px;
    padding: 0 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-transform: none;
}

.policy-form-grid input:focus,
.policy-form-grid select:focus,
.policy-form-insured-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(201, 19, 31, 0.09);
}

.policy-form-wide {
    grid-column: span 2;
}

.policy-form-subject-toggle {
    display: flex;
    gap: 18px;
    margin-bottom: 16px;
}

.policy-form-subject-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
}

.policy-form-insured-list {
    display: grid;
    gap: 10px;
}

.policy-form-insured-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    align-items: end;
    gap: 10px;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fafafa;
}

.secondary-button {
    min-height: 36px;
    border: 1px solid #cfc5c7;
    border-radius: 6px;
    padding: 0 12px;
    background: #fff;
    color: #4c4244;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.secondary-button:hover {
    background: #faf4f5;
    border-color: #bda8ac;
}

.policy-form-remove-insured {
    min-height: 38px;
    border: 0;
    background: transparent;
    color: #9f0d18;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.policy-form-card details summary {
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
}

.policy-form-card details summary span {
    margin-left: 8px;
    color: #888;
    font-size: 12px;
    font-weight: 400;
}

.policy-form-cession-grid {
    margin-top: 16px;
}

.policy-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 4px 0 24px;
}

.policy-form-notice {
    min-height: 20px;
    margin: 0;
    color: #8d1720;
    font-size: 13px;
    font-weight: 600;
}

@media (max-width: 800px) {
    .policy-form-grid,
    .policy-form-insured-row {
        grid-template-columns: 1fr 1fr;
    }

    .policy-form-wide {
        grid-column: span 2;
    }

    .policy-form-remove-insured {
        justify-self: start;
    }
}

@media (max-width: 540px) {
    .policy-form-grid,
    .policy-form-insured-row {
        grid-template-columns: 1fr;
    }

    .policy-form-wide {
        grid-column: auto;
    }

    .policy-form-subject-toggle,
    .policy-form-actions {
        align-items: stretch;
        flex-direction: column;
    }
}
/* Polisy 2.0 – statyczny etap układu */
.policies2-header{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:22px}.policies2-header h2{margin:0;color:#182b4d}.policies2-header p{margin:5px 0 0;color:#6b7280}.policies2-actions{display:flex;gap:10px}.policies2-import{background:#fff;border:1px solid #d7dce5;border-radius:8px;padding:10px 15px;color:#182b4d}.policies2-stats{display:grid;grid-template-columns:repeat(6,1fr);gap:12px;margin-bottom:18px}.policies2-stats article,.policies2-filters{background:#fff;border:1px solid #e1e5eb;border-radius:10px}.policies2-stats article{padding:14px}.policies2-stats span{display:block;color:#667085;font-size:13px}.policies2-stats strong{display:block;margin-top:8px;font-size:24px;color:#182b4d}.policies2-filters{padding:16px;margin-bottom:18px}.policies2-filters>div{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:12px}.policies2-filters>div:last-child{margin-bottom:0}.policies2-filters label{display:grid;gap:5px;color:#475467;font-size:12px}.policies2-filters input,.policies2-filters select,.policies2-filters button,.policies2-footer select{min-height:36px;border:1px solid #d7dce5;border-radius:6px;padding:0 9px;background:#fff}.policies2-filters button:first-of-type{background:#bf2637;color:#fff;border-color:#bf2637}.policies2-table th{white-space:nowrap}.policies2-footer{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:14px 0;color:#667085}.policies2-footer label{display:flex;align-items:center;gap:8px}@media(max-width:1100px){.policies2-stats{grid-template-columns:repeat(3,1fr)}}@media(max-width:700px){.policies2-header{align-items:flex-start;flex-direction:column}.policies2-stats{grid-template-columns:repeat(2,1fr)}.policies2-actions{width:100%}.policies2-actions button{flex:1}.policies2-footer{flex-wrap:wrap}}

/* =========================================================
   POLISY 2.0 — PAGINACJA
   ========================================================= */

.policies2-table-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    padding: 14px 0 4px;
}

.policies2-table-footer > :first-child {
    justify-self: start;
}

#policies2PaginationSummary {
    justify-self: center;
    color: #64748b;
    font-size: 13px;
    white-space: nowrap;
}

#policies2Pagination {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 7px;
}

.policies2-page-button {
    appearance: none;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #d9e1ec;
    border-radius: 8px;

    background: #ffffff;
    color: #17233c;

    font: inherit;
    font-size: 13px;
    font-weight: 700;

    cursor: pointer;
    transition:
        background-color .15s ease,
        border-color .15s ease,
        color .15s ease,
        transform .15s ease,
        box-shadow .15s ease;
}

.policies2-page-button:hover:not(:disabled):not(.active) {
    border-color: #e30613;
    color: #e30613;
    background: #fff7f8;
    transform: translateY(-1px);
}

.policies2-page-button.active {
    border-color: #e30613;
    background: #e30613;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(227, 6, 19, .18);
}

.policies2-page-button:disabled {
    background: #f4f6f9;
    border-color: #e3e8ef;
    color: #a7b0bd;
    cursor: default;
    opacity: .75;
}

#policies2PageSize {
    min-width: 68px;
    height: 38px;
    padding: 0 28px 0 11px;
    border: 1px solid #d9e1ec;
    border-radius: 8px;
    background-color: #ffffff;
    color: #17233c;
    font-weight: 600;
}

@media (max-width: 900px) {
    .policies2-table-footer {
        grid-template-columns: 1fr;
    }

    .policies2-table-footer > :first-child,
    #policies2PaginationSummary,
    #policies2Pagination {
        justify-self: center;
    }
}


/* =========================================================
   POLISY 2.0 — BADGE I AKCJE
   ========================================================= */

.policies2-category-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 5px;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}

.policies2-category-badge.is-property {
    color: #d91f2d;
    background: #fff0f2;
}

.policies2-category-badge.is-vehicle {
    color: #1264d8;
    background: #eaf3ff;
}

.policies2-payment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
}

.policies2-payment-badge.is-paid {
    color: #11863b;
    background: #e7f8ed;
}

.policies2-payment-badge.is-open {
    color: #d71920;
    background: #ffe8e9;
}

.policies2-payment-badge.is-partial {
    color: #b96700;
    background: #fff2dc;
}

.policies2-payment-badge.is-neutral {
    color: #596579;
    background: #eef1f5;
}

.policy-open-detail-button {
    appearance: none;
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #ffd1d5;
    border-radius: 7px;
    background: #ffffff;
    cursor: pointer;

    transition:
        background-color .15s ease,
        border-color .15s ease,
        transform .15s ease;
}

.policy-open-detail-button:hover {
    background: #fff2f3;
    border-color: #e30613;
    transform: translateY(-1px);
}

.policies2-eye-icon {
    position: relative;
    display: block;
    width: 17px;
    height: 11px;

    border: 2px solid #e30613;
    border-radius: 50% / 60%;
}

.policies2-eye-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;

    width: 5px;
    height: 5px;

    background: #e30613;
    border-radius: 50%;

    transform: translate(-50%, -50%);
}

#policies-table td {
    vertical-align: middle;
}

#policies-table td:nth-child(2) strong,
#policies-table td:nth-child(3) strong {
    color: #17233c;
}


/* =========================================================
   POLISY 2.0 — DOPIESZCZENIE TABELI
   ========================================================= */

#policies-table tr {
    transition:
        background-color .15s ease,
        box-shadow .15s ease;
}

#policies-table tr:hover {
    background: #fffafb;
}

#policies-table td {
    padding-top: 13px;
    padding-bottom: 13px;
}

#policies-table td:nth-child(2) strong {
    font-size: 13px;
    font-weight: 750;
    letter-spacing: .1px;
}

#policies-table td:nth-child(2) > div {
    margin-top: 3px;
    color: #566176;
    font-size: 12px;
}

.policies2-insurer {
    display: inline-block;
    max-width: 150px;
    color: #28344b;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
}

.policies2-subject {
    display: inline-block;
    max-width: 220px;
    color: #39465b;
    font-size: 12px;
    line-height: 1.45;
}

.policies2-period {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    white-space: nowrap;
    color: #39465b;
    font-size: 12px;
    line-height: 1.35;
}

.policies2-period-arrow {
    display: none;
}

#policies-table td:nth-child(8) strong {
    color: #17233c;
    font-size: 13px;
    white-space: nowrap;
}

#policies-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #e30613;
    cursor: pointer;
}


/* =========================================================
   POLISY 2.0 — KAFELKI STATYSTYK
   ========================================================= */

.policies2-stats {
    gap: 12px;
}

.policies2-stat-card {
    position: relative;
    overflow: hidden;
    min-height: 92px;
    padding: 16px 18px;

    background: #ffffff;
    border: 1px solid #e7eaf0;
    border-radius: 12px;

    box-shadow: 0 2px 8px rgba(23, 35, 60, .035);

    transition:
        transform .15s ease,
        box-shadow .15s ease,
        border-color .15s ease;
}

.policies2-stat-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;

    width: 3px;
    border-radius: 0 4px 4px 0;
    background: #e30613;
    opacity: .8;
}

.policies2-stat-card:hover {
    transform: translateY(-2px);
    border-color: #f0c9cd;
    box-shadow: 0 7px 18px rgba(23, 35, 60, .08);
}

.policies2-stat-card .value,
.policies2-stat-card strong {
    color: #17233c;
    font-weight: 800;
}

#policies2StatAll,
#policies2StatActive,
#policies2StatExpiring,
#policies2StatRenewals,
#policies2StatPayment,
#policies2StatTasks {
    font-size: 23px;
    line-height: 1;
    font-weight: 800;
}

/* =========================================================
   POLISY 2.0 — PANEL FILTRÓW
   ========================================================= */

.policies2-filters {
    padding: 18px;
    background: #ffffff;
    border: 1px solid #e6eaf0;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(23, 35, 60, .035);
}

.policies2-filters label {
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .15px;
}

.policies2-filters select,
.policies2-filters input {
    min-height: 38px;

    background: #ffffff;
    border: 1px solid #dce2ea;
    border-radius: 7px;

    color: #17233c;
    font-size: 12px;

    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        background-color .15s ease;
}

.policies2-filters select:hover,
.policies2-filters input:hover {
    border-color: #c5ccd6;
}

.policies2-filters select:focus,
.policies2-filters input:focus {
    outline: none;
    border-color: #e30613;
    box-shadow: 0 0 0 3px rgba(227, 6, 19, .08);
}

#policies2SearchButton {
    min-height: 38px;
    border-radius: 7px;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(227, 6, 19, .14);
}

#policies2SearchButton:hover {
    transform: translateY(-1px);
}

#policies2ClearButton {
    min-height: 38px;
    border-radius: 7px;
    font-weight: 650;
}

/* =========================================================
   POLISY 2.0 — KARTA TABELI
   ========================================================= */

.policies2-table-card {
    overflow: hidden;

    background: #ffffff;
    border: 1px solid #e5e9ef;
    border-radius: 12px;

    box-shadow: 0 4px 16px rgba(23, 35, 60, .045);
}

.policies2-table-card table {
    margin: 0;
}

.policies2-table-card thead th {
    background: #f8f9fb;
    color: #647084;

    font-size: 10px;
    font-weight: 800;
    letter-spacing: .3px;
    text-transform: uppercase;

    border-bottom: 1px solid #e5e9ef;
}

#policies-table tr:last-child td {
    border-bottom: 0;
}


/* =========================================================
   POLISY 2.0 — NAGŁÓWEK I POPRAWKA KAFELKÓW
   ========================================================= */

.policies2-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.policies2-header h2 {
    margin: 0;
    color: #17233c;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.35px;
}

.policies2-header p {
    margin: 5px 0 0;
    color: #738095;
    font-size: 13px;
}

.policies2-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.policies2-actions button {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;

    transition:
        transform .15s ease,
        box-shadow .15s ease,
        border-color .15s ease,
        background-color .15s ease;
}

.policies2-import {
    background: #ffffff;
    border: 1px solid #d9e0e9;
    color: #27364e;
}

.policies2-import:hover {
    background: #fff7f8;
    border-color: #e30613;
    color: #e30613;
    transform: translateY(-1px);
}

#openPolicyFormButton {
    border-color: #e30613;
    background: #e30613;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(227, 6, 19, .16);
}

#openPolicyFormButton:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(227, 6, 19, .22);
}

/* HTML używa <article>, nie .policies2-stat-card */
.policies2-stats article {
    position: relative;
    overflow: hidden;
    min-height: 92px;
    padding: 16px 18px;

    background: #ffffff;
    border: 1px solid #e7eaf0;
    border-radius: 12px;

    box-shadow: 0 2px 8px rgba(23, 35, 60, .035);

    transition:
        transform .15s ease,
        box-shadow .15s ease,
        border-color .15s ease;
}

.policies2-stats article::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;

    width: 3px;
    border-radius: 0 4px 4px 0;
    background: #e30613;
    opacity: .8;
}

.policies2-stats article:hover {
    transform: translateY(-2px);
    border-color: #f0c9cd;
    box-shadow: 0 7px 18px rgba(23, 35, 60, .08);
}

.policies2-stats article > span {
    color: #69768a;
    font-size: 12px;
    font-weight: 650;
}

.policies2-stats article > strong {
    display: block;
    margin-top: 10px;
    color: #17233c;
    font-size: 24px;
    font-weight: 800;
}

@media (max-width: 700px) {
    .policies2-header {
        align-items: stretch;
    }

    .policies2-actions {
        width: 100%;
    }

    .policies2-actions button {
        flex: 1;
    }
}


/* =========================================================
   POLISY 2.0 — USUWANIE ZAZNACZONEJ POLISY
   ========================================================= */

.policies2-delete {
    background: #ffffff;
    border: 1px solid #e30613;
    color: #d40816;
}

.policies2-delete:not(:disabled):hover {
    background: #fff3f4;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(227, 6, 19, .10);
}

.policies2-delete:disabled {
    background: #f7f8fa;
    border-color: #e2e6ec;
    color: #aeb6c2;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}


/* =========================================================
   POLISY 2.0 — FILTRY W JEDNYM RZĘDZIE NA DESKTOPIE
   ========================================================= */

@media (min-width: 1201px) {
    .policies2-filters {
        display: grid;
        grid-template-columns:
            minmax(115px, .9fr)
            minmax(115px, .9fr)
            minmax(115px, .9fr)
            minmax(110px, .85fr)
            minmax(130px, 1.15fr)
            minmax(125px, .95fr)
            minmax(125px, .95fr)
            auto
            auto;
        gap: 10px;
        align-items: end;
    }

    .policies2-filters > div {
        display: contents;
    }

    .policies2-filters label {
        min-width: 0;
    }

    .policies2-filters label select,
    .policies2-filters label input {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    #policies2SearchButton,
    #policies2ClearButton {
        align-self: end;
        white-space: nowrap;
        padding-left: 14px;
        padding-right: 14px;
    }
}



/* CLIENT FORM 6O.2B */

.client-form-dialog {
    width: min(820px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
    overflow: hidden;
}

.client-form-dialog::backdrop {
    background: rgba(15, 23, 42, .48);
    backdrop-filter: blur(2px);
}

.client-form {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
}

.client-form-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 26px 18px;
    border-bottom: 1px solid #e5e7eb;
}

.client-form-header h2 {
    margin: 0;
    font-size: 22px;
}

.client-form-header p {
    margin: 6px 0 0;
    color: #64748b;
}

.client-form-close {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.client-form-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.client-form-body {
    padding: 22px 26px;
    overflow-y: auto;
}

.client-form-section + .client-form-section {
    margin-top: 24px;
}

.client-form-section h3 {
    margin: 0 0 14px;
    font-size: 15px;
    color: #334155;
}

.client-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px 18px;
}

.client-form-grid label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.client-form-grid label > span {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.client-form-grid input,
.client-form-grid select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: #0f172a;
    font: inherit;
}

.client-form-grid input:focus,
.client-form-grid select:focus {
    outline: none;
    border-color: #64748b;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, .12);
}

.client-form-wide {
    grid-column: 1 / -1;
}

.client-consents {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
}

.client-consents label {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    cursor: pointer;
}

.client-consents input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
}

.client-form-status {
    min-height: 20px;
    margin-top: 18px;
    font-size: 13px;
    color: #b91c1c;
}

.client-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 17px 26px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
}

@media (max-width: 700px) {
    .client-form-grid,
    .client-consents {
        grid-template-columns: 1fr;
    }

    .client-form-wide {
        grid-column: auto;
    }

    .client-form-header,
    .client-form-body,
    .client-form-actions {
        padding-left: 18px;
        padding-right: 18px;
    }
}

/* CLIENT FORM — poprawne ukrywanie pól osoba/firma */
.client-form [hidden] {
    display: none !important;
}

/* CLIENT FORM — centrowanie modala */
.client-form-dialog[open] {
    position: fixed;
    inset: 0;
    margin: auto;
}

/* CLIENT FORM — poprawne ukrywanie pól osoba/firma */
.client-form [hidden] {
    display: none !important;
}

/* Calendar 6P.1 — scoped read-only calendar. */
#page-calendar .calendar-range-note { color: var(--text-muted); margin-bottom: 16px; }
#page-calendar .calendar-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
#page-calendar button { font: inherit; cursor: pointer; }
#page-calendar .calendar-toolbar button, #page-calendar #calendarRetry { background: white; color: var(--primary); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; }
#page-calendar .calendar-toolbar h3 { margin-left: 8px; text-transform: capitalize; }
#page-calendar #calendarStatus:not(:empty) { padding: 12px 0; color: var(--text-muted); }
#page-calendar #calendarRetry { margin-bottom: 12px; }
#page-calendar .calendar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
#page-calendar .calendar-month-card, #page-calendar .calendar-panel { border: 1px solid var(--border); border-radius: 12px; background: #fff; overflow: hidden; }
#page-calendar .calendar-month-scroll { overflow-x: auto; }
#page-calendar .calendar-weekdays, #page-calendar .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 700px; }
#page-calendar .calendar-weekdays { background: var(--primary-light); text-align: center; font-weight: 600; color: var(--text-muted); }
#page-calendar .calendar-weekdays span { padding: 10px 4px; }
#page-calendar .calendar-day { min-height: 130px; padding: 5px; border-top: 1px solid var(--border); border-right: 1px solid var(--border); min-width: 0; cursor: pointer; }
#page-calendar .calendar-day:nth-child(7n) { border-right: 0; }
#page-calendar .calendar-day-empty { background: #fafafa; cursor: default; }
#page-calendar .calendar-day.is-today { background: var(--primary-light); }
#page-calendar .calendar-day.is-selected { box-shadow: inset 0 0 0 2px var(--primary); }
#page-calendar .calendar-day-select { display: block; width: 100%; text-align: left; padding: 4px 6px; border: 0; background: transparent; color: var(--text); border-radius: 5px; font-weight: 600; }
#page-calendar .is-today .calendar-day-select { color: var(--primary); font-weight: 800; }
#page-calendar .calendar-policy-event { display: block; width: 100%; text-align: left; background: var(--primary-light); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 7px; padding: 7px; margin-top: 6px; color: var(--text); overflow-wrap: anywhere; }
#page-calendar .calendar-policy-event strong, #page-calendar .calendar-policy-event span { display: block; }
#page-calendar .calendar-grid .calendar-policy-event { font-size: 11px; }
#page-calendar .calendar-grid .calendar-open-label { display: none; }
#page-calendar .calendar-event-date, #page-calendar .calendar-open-label { color: var(--primary); font-weight: 600; }
#page-calendar .calendar-more { border: 0; background: transparent; padding: 6px; color: var(--primary); }
#page-calendar button:hover { background-color: #ffe2e5; }
#page-calendar button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#page-calendar .calendar-side { display: grid; gap: 18px; }
#page-calendar .calendar-panel { padding: 16px; }
#page-calendar .calendar-panel h3 { font-size: 16px; margin-bottom: 12px; }
#page-calendar .calendar-empty { padding: 10px 0; color: var(--text-muted); }
@media (max-width: 1200px) { #page-calendar .calendar-layout { grid-template-columns: minmax(0, 1fr); } #page-calendar .calendar-side { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 650px) { #page-calendar .calendar-side { grid-template-columns: minmax(0, 1fr); } }

/* Calendar 6P.2B — read-only tasks. */
#page-calendar .calendar-task-event { background: #f5f6f8; border: 1px solid #d9dde3; border-left: 3px solid #80676c; border-radius: 7px; padding: 7px; margin-top: 6px; overflow-wrap: anywhere; }
#page-calendar .calendar-task-event strong, #page-calendar .calendar-task-event span { display: block; }
#page-calendar .calendar-task-type { color: var(--text-muted); font-weight: 600; }
#page-calendar .calendar-grid .calendar-task-event { font-size: 11px; }
#page-calendar .calendar-task-event p { margin: 6px 0; white-space: pre-wrap; }
#page-calendar .calendar-task-event.is-done { opacity: .75; }
#page-calendar .calendar-task-event.is-canceled strong { text-decoration: line-through; }
#page-calendar .calendar-task-event button { display: block; margin-top: 6px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--primary); }

/* Calendar 6P.2C — create task dialog. */
#page-calendar .calendar-toolbar #calendarNewTask { margin-left: auto; background: var(--primary); color: #fff; border-color: var(--primary); }
#page-calendar .calendar-toolbar #calendarNewTask:hover { background: var(--primary-dark); }
#calendarTaskCreateDialog { margin: auto; width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; border: 1px solid var(--border); border-radius: 12px; padding: 24px; color: var(--text); background: #fff; }
#calendarTaskCreateDialog::backdrop { background: rgba(30,20,24,.4); }
#calendarTaskCreateDialog h2 { margin-bottom: 18px; }
#calendarTaskCreateDialog fieldset { border: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; min-width: 0; }
#calendarTaskCreateDialog label { display: grid; gap: 5px; font-weight: 600; min-width: 0; }
#calendarTaskCreateDialog input, #calendarTaskCreateDialog select, #calendarTaskCreateDialog textarea { width: 100%; min-width: 0; padding: 9px; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; color: var(--text); }
#calendarTaskCreateDialog .calendar-task-description { grid-column: 1 / -1; }
#calendarTaskCreateDialog footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#calendarTaskCreateMessage:not(:empty) { margin-top: 14px; }
#calendarTaskCreateDialog button:disabled { opacity: .6; cursor: wait; }
@media(max-width: 600px) { #calendarTaskCreateDialog fieldset { grid-template-columns: minmax(0,1fr); } }

/* DOK.2 — scoped global document list. */
#page-documents { min-width: 0; }
#page-documents .documents-list-summary { display: flex; align-items: center; gap: 14px; color: var(--text-muted); }
#page-documents .documents-list-summary strong { font-size: 26px; color: var(--primary); }
#page-documents .documents-list-scroll { width: 100%; max-width: 100%; overflow-x: auto; border-radius: 12px; }
#documentsListTable { width: 100%; min-width: 1050px; table-layout: fixed; }
#documentsListTable th, #documentsListTable td { white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
#documentsListTable th:nth-child(1) { width: 90px; }
#documentsListTable th:nth-child(2) { width: 22%; }
#documentsListTable th:nth-child(4) { width: 18%; }
#documentsListTable th:last-child { width: 110px; }

/* DOK.3 — document filters only. */
#page-documents .documents-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; min-width: 0; margin: 0 0 12px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
#page-documents .documents-filters-title { padding: 0 5px; font-weight: 600; color: var(--text-muted); }
#page-documents .documents-filters label { display: flex; flex-direction: column; gap: 5px; flex: 1 1 180px; min-width: 0; font-weight: 600; }
#page-documents .documents-filters .documents-search-label { flex: 2 1 260px; }
#page-documents .documents-filters input, #page-documents .documents-filters select { width: 100%; min-width: 0; height: 38px; padding: 7px 10px; font: inherit; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); }
#page-documents .documents-filters button { min-height: 38px; }
#page-documents .documents-results-count { margin: 0 0 12px; color: var(--text-muted); }

/* PolisNET 2.0 dashboard */
.dashboard2-hero{display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:22px;padding:24px 26px;border:1px solid var(--border);border-radius:18px;background:#fff}
.dashboard2-eyebrow{display:block;margin-bottom:4px;font-size:11px;font-weight:800;letter-spacing:.12em;color:var(--primary)}
.dashboard2-hero h2{font-size:26px;margin:0 0 4px}.dashboard2-hero p{color:var(--text-muted)}
.dashboard2-actions{display:flex;gap:10px;flex-wrap:wrap}
.dashboard2-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px}
.dashboard2-stat{padding:18px;border:1px solid var(--border);border-radius:16px;background:#fff;box-shadow:0 5px 18px rgba(80,25,35,.05)}
.dashboard2-stat[data-dashboard-target]{cursor:pointer}.dashboard2-stat span,.dashboard2-stat small{display:block;color:var(--text-muted)}
.dashboard2-stat strong{display:block;margin:7px 0 3px;font-size:28px;color:var(--primary)}
.dashboard2-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.dashboard2-panel{padding:20px;border:1px solid var(--border);border-radius:16px;background:#fff}
.dashboard2-panel-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:12px}.dashboard2-panel-head h3{font-size:17px}.dashboard2-panel-head p{font-size:12px;color:var(--text-muted)}
.dashboard2-link{border:0;background:transparent;color:var(--primary);font-weight:700;cursor:pointer}
.dashboard2-list{display:grid;gap:8px}.dashboard2-row{width:100%;display:flex;justify-content:space-between;gap:18px;padding:11px 12px;border:1px solid #f0dfe2;border-radius:11px;background:#fff;text-align:left;color:inherit}
button.dashboard2-row{cursor:pointer}.dashboard2-row:hover{background:var(--primary-light)}.dashboard2-row span:last-child{text-align:right}.dashboard2-row strong,.dashboard2-row small{display:block}.dashboard2-row small{color:var(--text-muted);margin-top:2px}.dashboard2-empty{padding:18px 8px;color:var(--text-muted);text-align:center}
.nav-button:disabled{opacity:.5;cursor:not-allowed}.nav-chevron{margin-left:auto;font-size:18px}
@media(max-width:1050px){.dashboard2-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.dashboard2-grid{grid-template-columns:1fr}}
@media(max-width:700px){.dashboard2-hero{align-items:flex-start;flex-direction:column}.dashboard2-stats{grid-template-columns:1fr}}

/* PolisNET 2.0 subject registers */
.subject-register-hero{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:18px;padding:22px 24px;border:1px solid var(--border);border-radius:16px;background:#fff}
.subject-register-hero h2{margin:0 0 4px}.subject-register-hero p{color:var(--text-muted)}
.subject-register-count{min-width:86px;text-align:center;padding:12px 16px;border-radius:13px;background:var(--primary-light);color:var(--primary)}
.subject-register-count strong{display:block;font-size:26px}.subject-register-count span{font-size:11px;font-weight:700}

.subject-register-tools{display:flex;align-items:end;justify-content:space-between;gap:16px;margin-bottom:14px;padding:14px 16px;border:1px solid var(--border);border-radius:14px;background:#fff}
.subject-register-tools label{display:grid;gap:5px;flex:1;max-width:620px}.subject-register-tools label span{font-size:12px;font-weight:700;color:var(--text-muted)}
.subject-register-tools input{width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:9px;background:#fff}
.subject-register-tools>span{font-size:12px;color:var(--text-muted);white-space:nowrap}
.subject-client-link{padding:0;border:0;background:none;color:var(--primary);font:inherit;font-weight:700;cursor:pointer;text-align:left}.subject-client-link:hover{text-decoration:underline}

.subject-main-link{padding:0;border:0;background:none;color:var(--primary);font:inherit;font-weight:800;cursor:pointer}.subject-main-link:hover{text-decoration:underline}
.subject-detail{margin-bottom:16px;padding:20px;border:1px solid #e4c9cf;border-radius:16px;background:#fff;box-shadow:0 8px 24px rgba(80,25,35,.06)}
.subject-detail-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}.subject-detail-head span{font-size:11px;font-weight:800;letter-spacing:.1em;color:var(--primary)}.subject-detail-head h3{margin:4px 0}.subject-detail-head p{color:var(--text-muted)}
.subject-detail-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:18px 0}.subject-detail-grid div{padding:12px;border-radius:10px;background:#faf7f8}.subject-detail-grid dt{font-size:11px;color:var(--text-muted)}.subject-detail-grid dd{margin:4px 0 0;font-weight:700}
.subject-detail h4{margin:16px 0 8px}.subject-policy-list{display:grid;gap:7px}.subject-policy-row{display:flex;justify-content:space-between;gap:16px;width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:#fff;text-align:left;cursor:pointer}.subject-policy-row:hover{background:var(--primary-light)}.subject-policy-row span:last-child{text-align:right}.subject-policy-row strong,.subject-policy-row small{display:block}.subject-policy-row small{color:var(--text-muted)}
@media(max-width:700px){.subject-detail-grid{grid-template-columns:1fr}}

.client360-subject-list{display:grid;gap:8px;margin-top:14px}.client360-subject-item{display:flex;align-items:center;justify-content:space-between;gap:18px;width:100%;padding:14px 16px;border:1px solid var(--border);border-radius:12px;background:#fff;text-align:left;cursor:pointer}.client360-subject-item:hover{border-color:#e6aab4;background:var(--primary-light)}.client360-subject-item span:last-child{text-align:right;min-width:55px}.client360-subject-item strong,.client360-subject-item small{display:block}.client360-subject-item strong{color:var(--primary)}.client360-subject-item small{margin-top:3px;color:var(--text-muted)}

.client360-hero-actions{margin-left:auto;display:flex;gap:8px;align-items:center}.client360-hero-status{margin-left:0}.client360-stats{grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:900px){.client360-hero{flex-wrap:wrap}.client360-hero-actions{order:3;width:100%;margin-left:0}.client360-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}


/* Authentication shell — UI only until server-side auth is enabled. */
.login-shell{min-height:100vh;display:grid;place-items:center;padding:24px;background:linear-gradient(135deg,#7d0f25 0%,#b51d3b 55%,#f5e8eb 100%)}
.login-shell[hidden]{display:none}
.login-card{width:min(430px,100%);padding:34px;border-radius:22px;background:#fff;box-shadow:0 24px 70px rgba(62,9,20,.28)}
.login-brand{font-size:30px;font-weight:900;color:var(--primary);letter-spacing:-.04em}.login-subtitle{margin-top:2px;color:var(--text-muted)}
.login-form{display:grid;gap:15px;margin-top:30px}.login-form[hidden]{display:none}.login-form h1{margin:0;font-size:25px}.login-form p{margin:-7px 0 4px;color:var(--text-muted)}
.login-form label{display:grid;gap:6px;font-size:13px;font-weight:700}.login-form input{width:100%;box-sizing:border-box;padding:12px 13px;border:1px solid var(--border);border-radius:10px;font:inherit;background:#fff}.login-form input:focus{outline:2px solid rgba(181,29,59,.18);border-color:var(--primary)}
.login-notice{min-height:20px;font-size:13px;color:#9b1831}.header-logout{border:1px solid var(--border);border-radius:9px;padding:7px 11px;background:#fff;color:var(--text);font-weight:700;cursor:pointer}


/* Dedicated vehicle/property card view. */
.subject-card-open > .subject-register-hero,
.subject-card-open > .subject-register-tools,
.subject-card-open > .table-container{display:none}
.subject-card-open > .subject-detail{margin-top:0}
.policy-detail-subject-embedded{margin-top:24px;padding-top:22px;border-top:1px solid var(--border)}
.policy-detail-subject-embedded .policy-detail-card-title{margin-bottom:14px}
