html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: pan-x pan-y;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

* {
    box-sizing: border-box;
}

:focus {
    outline: none;
}

h1, h2, h3, h4, h5, h6 {
    outline: none;
}

body {
    font-family: Helvetica, sans-serif;
    background-color: #fff;
}

#app {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
textarea,
select {
    font-size: 16px !important;
    max-width: 100%;
}

.pm-page-header {
    width: min(1220px, 100%);
    margin: 0 auto 22px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
}

.pm-page-header-copy {
    min-width: 0;
}

.pm-eyebrow {
    display: block;
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: .07em;
}

.pm-page-header h1 {
    margin: 4px 0;
    color: #0f172a;
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 900;
    letter-spacing: -0.03em;
}

.pm-page-header p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 600;
}

.pm-back-button,
.pm-icon-button {
    width: 42px;
    height: 42px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.pm-back-button:hover,
.pm-icon-button:hover {
    transform: translateY(-1px);
    border-color: #cbd5e1;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.pm-save-button,
.pm-primary-button {
    min-height: 44px;
    border: none;
    border-radius: 14px;
    background: #0f172a;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14);
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.pm-save-button:hover,
.pm-primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 42px rgba(15, 23, 42, 0.18);
}

.pm-save-button:disabled,
.pm-primary-button:disabled {
    opacity: .58;
    cursor: not-allowed;
    transform: none;
}

.pm-secondary-button {
    min-height: 42px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #ffffff;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
}

.pm-search-shell {
    min-height: 46px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.04);
}

.pm-search-shell:focus-within {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px #dbeafe;
}

.pm-search-shell .material-symbols-rounded {
    color: #94a3b8;
    font-size: 20px;
}

.pm-search-shell input {
    border: 0;
    outline: 0;
    background: transparent;
    min-width: 0;
    width: 100%;
    color: #0f172a;
    font-weight: 700;
}

.pm-refresh-indicator {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 800;
    z-index: 9999;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.28);
    animation: pm-slide-up .24s ease;
}

.pm-refresh-indicator .pm-spinner-small {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.28);
    border-top-color: white;
    border-radius: 50%;
    animation: pm-spin .8s linear infinite;
}

@keyframes pm-spin { to { transform: rotate(360deg); } }
@keyframes pm-slide-up {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 720px) {
    .pm-page-header {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .pm-page-header-actions {
        grid-column: 1 / -1;
        width: 100%;
        display: flex;
    }

    .pm-page-header-actions .pm-save-button,
    .pm-page-header-actions .pm-primary-button {
        width: 100%;
    }
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.app-loading-container {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    display: flex !important;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
    z-index: 2147483647;
    flex-direction: column;
}

.app-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 280px;
    max-width: 80%;
}

.app-icon {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1b6ec2;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
    animation: fadeUp 0.8s ease-out;
}

.typing-indicator {
    display: flex;
    gap: 6px;
    margin-bottom: 2rem;
}

.typing-indicator span {
    width: 10px;
    height: 10px;
    background-color: #1b6ec2;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

.progress-wrapper {
    width: 100%;
    height: 4px;
    background-color: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background-color: #1b6ec2;
    width: var(--blazor-load-percentage, 0%);
    transition: width 0.2s ease-out;
    border-radius: 2px;
}

.loading-status-text {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #999;
    font-weight: 500;
    height: 1.2rem;
}

.loading-status-text:after {
    content: var(--blazor-load-percentage-text, "Inicjalizacja...");
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

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

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* User account page */
.user-page-shell {
    width: min(960px, 100%);
    margin: 0 auto;
    padding: 6px 0 44px;
    color: #0f172a;
}

.user-hero {
    min-height: 112px;
    border-radius: 18px;
    padding: 18px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px -28px rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar-large {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    border-radius: 18px;
    background: #0f172a;
    color: #ffffff;
    display: grid;
    place-items: center;
    font-size: 19px;
    font-weight: 800;
}

.user-hero-copy span {
    color: #059669;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.user-hero-copy h1 {
    margin: 5px 0 6px;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.08;
    letter-spacing: -0.02em;
}

.user-hero-copy p {
    margin: 0;
    max-width: 620px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 600;
}

.user-loading,
.account-alert {
    margin-top: 14px;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid #e2e8f0;
    background: #ffffff;
}

.user-loading {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #64748b;
}

.account-alert.success {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.account-alert.error {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

.mini-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #d1fae5;
    border-top-color: #059669;
    animation: spin 0.75s linear infinite;
}

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

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

.account-panel,
.delete-info-panel,
.legal-account-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 8px 24px -24px rgba(15, 23, 42, 0.45);
}

.account-panel {
    padding: 16px;
}

.panel-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-title > span {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #ecfdf5;
    color: #059669;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    font-size: 22px;
}

.panel-title h2 {
    margin: 0 0 4px;
    font-size: 16px;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.panel-title p {
    margin: 0;
    color: #64748b;
    line-height: 1.4;
    font-size: 12px;
    font-weight: 600;
}

.current-email {
    margin-bottom: 14px;
    padding: 11px 12px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: grid;
    gap: 3px;
}

.current-email span {
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.current-email strong {
    word-break: break-word;
    font-size: 13px;
}

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

.form-stack label {
    display: grid;
    gap: 6px;
    color: #475569;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.user-page-shell .user-form-input,
.user-page-shell input.user-form-input {
    width: 100% !important;
    min-height: 42px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 0 12px !important;
    outline: none !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    box-shadow: none !important;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.user-page-shell .user-form-input:focus {
    background: #ffffff !important;
    border-color: #0f172a !important;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08) !important;
}

.user-page-shell .validation-message {
    color: #dc2626;
    font-size: 11px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.primary-account-btn {
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    background: #0f172a;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, opacity 0.2s;
}

.primary-account-btn .material-symbols-rounded {
    font-size: 19px;
}

.primary-account-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #111827;
}

.primary-account-btn:disabled {
    opacity: 0.68;
    cursor: not-allowed;
}

.delete-info-panel {
    margin-top: 14px;
    padding: 16px;
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 12px;
    background: #fff7ed;
    border-color: #fed7aa;
}

.delete-info-panel span {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #c2410c;
    background: #ffedd5;
    font-size: 22px;
}

.delete-info-panel h2 {
    margin: 0 0 5px;
    font-size: 17px;
}

.delete-info-panel p {
    margin: 0;
    color: #7c2d12;
    line-height: 1.5;
    font-size: 13px;
    font-weight: 600;
}

.delete-info-panel a {
    color: #9a3412;
    font-weight: 800;
}

.legal-account-panel {
    margin-top: 14px;
    padding: 18px;
}

.legal-wrapper {
    max-height: 560px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #f8fafc;
}

@media (max-width: 900px) {
    .user-page-shell {
        padding: 0 0 44px;
    }

    .user-hero {
        align-items: flex-start;
        border-radius: 18px;
    }

    .account-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .user-hero {
        flex-direction: column;
        padding: 16px;
    }

    .user-avatar-large {
        width: 54px;
        height: 54px;
        flex-basis: 54px;
        border-radius: 16px;
        font-size: 17px;
    }

    .account-panel,
    .delete-info-panel,
    .legal-account-panel {
        border-radius: 16px;
        padding: 14px;
    }

    .delete-info-panel {
        grid-template-columns: 1fr;
    }
}

.pm-mouse-hint {
    position: fixed;
    z-index: 100000;
    width: min(292px, calc(100vw - 24px));
    padding: 14px 15px;
    border: 1px solid rgba(203, 213, 225, .9);
    border-radius: 12px;
    background: rgba(15, 23, 42, .97);
    color: #fff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .24);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px) scale(.98);
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.pm-mouse-hint.visible { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.pm-mouse-hint strong { display: block; margin: 0 0 5px; font-size: 13px; line-height: 1.3; font-weight: 800; }
.pm-mouse-hint p { margin: 0; color: #cbd5e1; font-size: 12px; line-height: 1.45; }

@media (max-width: 720px), (hover: none), (pointer: coarse) {
    .pm-mouse-hint { display: none !important; }
}

.file-input-overlay {
        position: absolute;
        top: 0; left: 0; width: 100%; height: 100%;
        opacity: 0; /* Ukrywa domyślny wygląd */
        cursor: pointer;
        z-index: 10; /* Warstwa klikalna nad zdjęciem */
    }

    /* --- SHEET WRAPPER --- */
    .sheet-wrapper {
        display: flex; flex-direction: column;
        height: 100%; max-height: 85vh; /* Ograniczenie w BottomSheet */
        font-family: 'Inter', sans-serif;
        color: #0F172A; background: white;
        position: relative;
    }

    .sheet-loading {
        position: absolute; inset: 0; background: rgba(255,255,255,0.8);
        z-index: 10; display: flex; align-items: center; justify-content: center;
        backdrop-filter: blur(2px);
    }

    /* --- HEADER --- */
    .sheet-header {
        padding: 24px 24px 16px 24px;
        display: flex; align-items: center; gap: 16px;
        border-bottom: 1px solid #F1F5F9;
        background: white;
    }

    .icon-hero {
        width: 48px; height: 48px; border-radius: 14px;
        display: flex; align-items: center; justify-content: center;
        font-size: 24px; flex-shrink: 0;
    }
    .icon-hero.teal { background: #CCFBF1; color: #0F766E; }
    .icon-hero.purple { background: #F3E8FF; color: #7E22CE; }
    .icon-hero.orange { background: #FFEDD5; color: #C2410C; }

    .header-text h3 { margin: 0; font-size: 18px; font-weight: 700; }
    .header-text p { margin: 4px 0 0 0; font-size: 13px; color: #64748B; }

    /* --- BODY --- */
    .sheet-body {
        padding: 24px; flex: 1; overflow-y: auto;
        display: flex; flex-direction: column; gap: 20px;
    }

    .row-2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

    /* --- INPUTS --- */
    .input-group { display: flex; flex-direction: column; gap: 8px; }
    .input-group label {
        font-size: 12px; font-weight: 700; text-transform: uppercase;
        color: #64748B; letter-spacing: 0.03em;
    }

    .main-input {
        width: 100%; padding: 12px 14px;
        border: 2px solid #E2E8F0; border-radius: 12px;
        font-size: 14px; font-weight: 500; color: #0F172A;
        outline: none; transition: 0.2s; box-sizing: border-box;
    }
    .main-input:focus { border-color: #0F172A; }
    .main-input.select { appearance: none; background: white; cursor: pointer; }

    /* Input z suffixem (zł) */
    .input-icon-wrapper { position: relative; }
    .input-icon-wrapper .main-input { padding-right: 36px; }
    .input-icon-wrapper .suffix {
        position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
        color: #94A3B8; font-weight: 600; font-size: 14px;
    }

    /* --- TOGGLE --- */
    .toggle-row {
        display: flex; justify-content: space-between; align-items: center;
        padding: 16px; background: #F8FAFC; border-radius: 12px;
        border: 1px solid #E2E8F0;
    }
    .toggle-label { display: flex; flex-direction: column; }
    .toggle-label .strong { font-size: 14px; font-weight: 600; }
    .toggle-label .small { font-size: 12px; color: #64748B; margin-top: 2px; }

    /* Switch iOS Style */
    .ios-switch { position: relative; width: 44px; height: 26px; }
    .ios-switch input { opacity: 0; width: 0; height: 0; }
    .slider {
        position: absolute; cursor: pointer; inset: 0;
        background-color: #CBD5E1; transition: .3s; border-radius: 34px;
    }
    .slider:before {
        position: absolute; content: ""; height: 20px; width: 20px;
        left: 3px; bottom: 3px; background-color: white;
        transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    input:checked + .slider { background-color: #0F172A; }
    input:checked + .slider:before { transform: translateX(18px); }

    /* --- COLOR PICKER --- */
    .color-picker-wrapper {
        display: flex; align-items: center; gap: 12px;
        border: 2px solid #E2E8F0; padding: 6px; border-radius: 12px;
    }
    .color-input {
        width: 40px; height: 40px; border: none; padding: 0;
        background: none; cursor: pointer; border-radius: 8px;
    }
    .color-input::-webkit-color-swatch-wrapper { padding: 0; }
    .color-input::-webkit-color-swatch { border: none; border-radius: 8px; }
    .color-hex { font-family: monospace; font-weight: 600; color: #475569; }

    /* --- STATUS PREVIEW --- */
    .preview-section {
        background: transparent; border: 0;
        border-radius: 18px; padding: 20px;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    }
    .preview-label { font-size: 11px; text-transform: uppercase; color: #94A3B8; font-weight: 700; }
    
    .status-preview-pill {
        padding: 6px 16px; border-radius: 100px;
        font-size: 13px; font-weight: 600;
        display: flex; align-items: center; gap: 8px;
        border: 1px solid transparent; background: rgba(0,0,0,0.05); /* Fallback */
    }
    .status-preview-pill .dot { width: 8px; height: 8px; border-radius: 50%; }

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

    .status-kind-option {
        border: 1px solid #E2E8F0;
        background: #FFFFFF;
        color: #475569;
        border-radius: 12px;
        padding: 10px 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: 12px;
        font-weight: 800;
        cursor: pointer;
        transition: 0.18s ease;
    }

    .status-kind-option .material-symbols-rounded {
        font-size: 18px;
    }

    .status-kind-option.active {
        border-color: #0F172A;
        background: #0F172A;
        color: #FFFFFF;
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
    }

    .kind-hint {
        display: block;
        margin-top: 8px;
        color: #64748B;
        font-size: 12px;
        line-height: 1.4;
    }

    @media (max-width: 520px) {
        .status-kind-grid {
            grid-template-columns: 1fr;
        }
    }

    /* --- INFO CARD --- */
    .info-card {
        padding: 12px; border-radius: 10px; display: flex; gap: 10px;
        font-size: 13px; line-height: 1.4;
    }
    .info-card.purple-tint { background: #FAF5FF; color: #6B21A8; border: 1px solid #E9D5FF; }
    .info-card .icon { font-size: 20px; }

    /* --- FOOTER ACTIONS --- */
    .sheet-footer {
    padding: 24px; border-top: 1px solid #F1F5F9;
    display: flex; gap: 12px; background: white;
    /* Zmiana: Zawijanie przycisków na małych ekranach */
    flex-wrap: wrap; 
}
.btn-action {
    flex: 1; padding: 14px; border-radius: 12px;
    font-weight: 600; font-size: 14px; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: 0.2s;
    /* Zmiana: Zapobiega zgniataniu tekstu */
    white-space: nowrap; 
    min-width: 120px;
}

.btn-action.primary { background: #3d0b72; color: white; }
.btn-action.secondary { background: white; border: 1px solid #E2E8F0; color: #213c7d; }
.btn-action.primary:active { transform: scale(0.98); background: #334155; }
.btn-action.secondary:active { transform: scale(0.98); background: #F1F5F9; }
.complex-row:active { background: #F1F5F9; }
/* LOGIKA HOVER TYLKO DLA MYSZKI */
@media (hover: hover) {
    .btn-action.primary:hover { background: #4b0c6a; }
    .btn-action.secondary:hover { background: #F8FAFC; }
    
    /* Wiersze listy */
    .complex-row:hover { background: #F8FAFC; cursor: pointer; }
}
    
    .mt-4 { margin-top: 16px; }

    /* =========================================
   LISTY I WIERSZE (GLOBALNE / DYNAMICZNE)
   ========================================= */

/* Kontener listy */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Odstęp między wierszami */
    min-height: 100px;
    width: 100%;
}



.complex-row:hover {
    background: #F8FAFC;
}



/* Ikona po lewej stronie wiersza */
.row-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0; /* Ikona nie może się zgniatać */
}

/* Kolory ikon w zależności od typu */
.row-icon.inspection { background: #F0FDFA; color: #0D9488; } /* Morski */
.row-icon.treatment { background: #EFF6FF; color: #2563EB; }  /* Niebieski */
.row-icon.loss { background: #FEF2F2; color: #DC2626; }       /* Czerwony */
.row-icon.passport { background: #F0FDF4; color: #16A34A; }   /* Zielony */

/* Środkowa część z treścią */
.row-content {
    flex: 1; /* Zajmuje całą dostępną przestrzeń */
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0; /* KLUCZOWE: Pozwala na działanie ellipsis wewnątrz flexa */
}

.row-title {
    font-size: 14px;
    font-weight: 600;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Trzy kropki jak tekst za długi */
    display: block;
}

.row-sub {
    font-size: 12px;
    color: #64748B;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Prawa strona (Data i status) */
.row-meta-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0; /* Prawa strona nie może się zgniatać */
    min-width: 80px; /* Minimalna szerokość dla czytelności */
}

.meta-date {
    font-size: 11px;
    color: #94A3B8;
    font-weight: 500;
    font-feature-settings: "tnum"; /* Monospaced numbers dla daty */
}

/* Badge statusów */
.status-badge {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}

.status-badge.ok { background: #ECFDF5; color: #059669; border: 1px solid #D1FAE5; }
.status-badge.warning { background: #FFFBEB; color: #D97706; border: 1px solid #FEF3C7; }
.status-badge.error { background: #FEF2F2; color: #DC2626; border: 1px solid #FEE2E2; }

/* Tag informacyjny (np. metoda aplikacji) */
.info-tag {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 100px; /* Pigułka */
    background: #F1F5F9;
    color: #475569;
    font-weight: 600;
    border: 1px solid #E2E8F0;
}

/* Ikona akcji (opcjonalna strzałka w prawo) */
.row-action {
    color: #CBD5E1;
    display: flex;
    align-items: center;
}

/* Stan pusty */
.empty-state {
    width: 100%;
    box-sizing: border-box;
    padding: 60px 24px;
    text-align: center;
    color: #94A3B8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    border-radius: 24px;
    margin-top: 20px;
}

.empty-state .material-symbols-rounded {
    font-size: 40px;
    opacity: 0.5;
    color: #64748B;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}


.language-account-panel {
    margin: 18px 0 22px;
}

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

.language-choice {
    min-height: 64px;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    background: #FFFFFF;
    color: #0F172A;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    text-align: left;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.language-choice span {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #F1F5F9;
    color: #475569;
    font-size: 12px;
    font-weight: 900;
}

.language-choice strong {
    font-size: 14px;
    font-weight: 800;
}

.language-choice.active {
    border-color: #86EFAC;
    background: #F7FDF9;
    box-shadow: 0 10px 24px rgba(22, 163, 74, .08);
}

.language-choice.active span {
    background: #DCFCE7;
    color: #15803D;
}

.language-choice:disabled {
    opacity: .7;
    cursor: wait;
}

.language-current {
    display: block;
    margin-top: 10px;
    color: #64748B;
    font-size: 12px;
    font-weight: 650;
}

@media (max-width: 560px) {
    .language-choice-row {
        grid-template-columns: 1fr;
    }
}

/* Guided tour fallback. Kept global so the first-run flow remains styled even
   while a client is replacing an older CSS-isolation bundle. */
.guided-tour { position: fixed; inset: 0; z-index: 7000; pointer-events: none; }
.guided-tour-focus { position: fixed; z-index: 7001; border: 2px solid rgba(255,255,255,.94); border-radius: 15px; box-shadow: 0 0 0 9999px rgba(10,17,28,.68), 0 0 0 5px rgba(71,159,108,.35), 0 18px 42px rgba(0,0,0,.24); transition: left .28s ease, top .28s ease, width .28s ease, height .28s ease; }
.guided-tour-card { position: fixed; z-index: 7002; max-width: calc(100vw - 24px); padding: 20px; border: 1px solid rgba(255,255,255,.82); border-radius: 18px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.28); color: #162033; pointer-events: auto; animation: pm-tour-card-in .2s ease-out; }
.guided-tour-card header { display: grid; grid-template-columns: 44px minmax(0,1fr) 32px; align-items: center; gap: 11px; }
.guided-tour-card .tour-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: #eaf5ee; color: #27734d; font-size: 23px; }
.guided-tour-card .tour-progress { display: block; margin-bottom: 3px; color: #78838e; font-size: 10px; font-weight: 850; text-transform: uppercase; }
.guided-tour-card h2 { margin: 0; color: #162033; font-size: 18px; line-height: 1.25; letter-spacing: 0; }
.guided-tour-card .tour-close { width: 32px; height: 32px; border: 0; border-radius: 9px; background: transparent; color: #77818d; display: grid; place-items: center; cursor: pointer; }
.guided-tour-card .tour-close:hover { background: #f1f4f5; color: #27313d; }
.guided-tour-card .tour-close .material-symbols-rounded { font-size: 20px; }
.guided-tour-card > p { margin: 17px 0; color: #596572; font-size: 13px; line-height: 1.6; }
.guided-tour-card .tour-dots { display: grid; grid-template-columns: repeat(10,minmax(8px,1fr)); gap: 4px; }
.guided-tour-card .tour-dots span { height: 4px; border-radius: 999px; background: #e1e6e8; transition: background .18s ease; }
.guided-tour-card .tour-dots span.active { background: #2e7652; }
.guided-tour-card .tour-dots span.done { background: #acd1ba; }
.guided-tour-card footer { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.guided-tour-card footer > div { display: flex; gap: 7px; }
.guided-tour-card .tour-skip,
.guided-tour-card .tour-back,
.guided-tour-card .tour-next { min-height: 39px; padding: 8px 12px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.guided-tour-card .tour-skip { padding-inline: 2px; border: 0; background: transparent; color: #77818d; }
.guided-tour-card .tour-back { border: 1px solid #dce2e5; background: #fff; color: #495460; }
.guided-tour-card .tour-next { border: 1px solid #1d2939; background: #1d2939; color: #fff; }
.guided-tour-card .tour-back .material-symbols-rounded,
.guided-tour-card .tour-next .material-symbols-rounded { font-size: 17px; }
@keyframes pm-tour-card-in { from { opacity: 0; transform: translateY(7px) scale(.98); } to { opacity: 1; transform: none; } }

@media (max-width: 700px) {
    .guided-tour-focus { border-radius: 13px; }
    .guided-tour-card { padding: 17px; border-radius: 16px; }
    .guided-tour-card footer { align-items: stretch; flex-direction: column-reverse; }
    .guided-tour-card footer > div { width: 100%; }
    .guided-tour-card .tour-next { flex: 1; }
    .guided-tour-card .tour-skip { align-self: center; min-height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
    .guided-tour-focus, .guided-tour-card { transition: none; animation: none; }
}
