:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #667085;
    --border: #dbe3ef;
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --container: 1180px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    width: min(100% - 32px, var(--container));
    margin: 0 auto;
}

.narrow-container {
    width: min(100% - 32px, 760px);
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(244, 247, 251, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(219, 227, 239, 0.8);
}

.header-inner {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.site-logo-link {
    display: flex;
    align-items: center;
    gap: 14px;
}

.site-logo-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    box-shadow: var(--shadow);
}

.site-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.site-title {
    font-size: 20px;
    font-weight: 800;
}

.site-tagline {
    font-size: 13px;
    color: var(--muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.id-language-switcher select {
    min-width: 130px;
    height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 14px;
}

.site-main {
    min-height: calc(100vh - 160px);
}

.page-section,
.hero-section {
    padding: 48px 0 64px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 28px;
    align-items: stretch;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.hero-content,
.hero-panel,
.auth-card,
.dashboard-header {
    padding: 34px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #e8f0ff;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
}

.hero-content h1,
.auth-card h1,
.dashboard-header h1 {
    margin: 0 0 14px;
    font-size: clamp(32px, 4vw, 52px);
    line-height: 1.1;
}

.hero-content p,
.section-intro,
.dashboard-header p {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.hero-buttons,
.form-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 700;
    transition: 0.2s ease;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-ghost {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}

.btn-ghost:hover {
    transform: translateY(-1px);
    border-color: #c4cfdf;
}

.btn-pass {
    background: #FFCC99;
    color: var(--text);
    border-color: var(--border);
}

.btn-pass:hover {
    transform: translateY(-1px);
    border-color: #c4cfdf;
}

.mini-cards {
    margin-top: 22px;
    display: grid;
    gap: 14px;
}

.mini-card {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #f9fbff;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mini-card strong {
    font-size: 16px;
}

.mini-card span {
    font-size: 14px;
    color: var(--muted);
}

.id-form {
    margin-top: 24px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: 50px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 15px;
    color: var(--text);
}

.form-group textarea {
    min-height: 140px;
    padding: 14px 16px;
    resize: vertical;
}

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

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

.dashboard-tile {
    padding: 28px;
    transition: 0.2s ease;
}

.dashboard-tile:hover {
    transform: translateY(-3px);
}

.dashboard-tile h2 {
    margin: 0 0 10px;
    font-size: 24px;
}

.dashboard-tile p {
    margin: 0;
    color: var(--muted);
}

.site-footer {
    border-top: 1px solid var(--border);
    background: #fff;
}

.footer-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-copy,
.footer-links a {
    color: var(--muted);
    font-size: 14px;
}

.footer-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.screen-reader-text {
    position: absolute;
    left: -9999px;
}

@media (max-width: 980px) {
    .hero-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .header-inner {
        padding: 12px 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
    }

    .id-language-switcher,
    .id-language-switcher select {
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .hero-content,
    .hero-panel,
    .auth-card,
    .dashboard-header,
    .dashboard-tile {
        padding: 24px;
    }
}

.id-form-error {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #f0b8b8;
    background: #fff1f1;
    color: #9f1d1d;
    font-weight: 600;
}

.id-form-success {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #b9e3c6;
    background: #eefbf2;
    color: #146c2e;
    font-weight: 600;
}

.profile-avatar-preview {
    margin-bottom: 10px;
}

.profile-avatar-preview img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
}

.avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
}

.dashboard-header-main {
    display: flex;
    align-items: center;
    gap: 18px;
}

.dashboard-avatar img,
.dashboard-avatar-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-avatar img {
    border: 2px solid var(--border);
    background: #fff;
}

.dashboard-avatar-placeholder {
    background: #e8f0ff;
    color: var(--primary);
    font-weight: 800;
    font-size: 20px;
    border: 2px solid var(--border);
}

@media (max-width: 720px) {
    .dashboard-header-main {
        align-items: flex-start;
        flex-direction: column;
    }
}

.consent-group {
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #f9fbff;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.consent-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

.consent-option input[type="checkbox"] {
    margin-top: 3px;
    flex: 0 0 auto;
}

.consent-status-box {
    margin-top: 20px;
    margin-bottom: 8px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #eef4ff;
    border: 1px solid #cfe0ff;
    color: #1e3a8a;
}

.id-section-divider {
    margin: 28px 0 20px;
    border: 0;
    border-top: 1px solid var(--border);
}

.id-section-title {
    margin: 0 0 16px;
    font-size: 22px;
    line-height: 1.2;
}

.form-checkbox-row label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 600;
}

.form-checkbox-row input[type="checkbox"] {
    margin-top: 4px;
}

.dashboard-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 980px) {
    .dashboard-info-grid {
        grid-template-columns: 1fr;
    }
}

.site-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.site-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-field.required span {
    font-weight: 700;
    color: #c62828;
}

.site-field small {
    margin-left: 6px;
    font-size: 12px;
    color: #888;
}

.dashboard-history-card {
    margin-top: 20px;
}

.ti-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.ti-history-table th {
    text-align: left;
    font-size: 14px;
    color: #666;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.ti-history-table td {
    padding: 12px 10px;
    vertical-align: top;
    border-bottom: 1px solid #f3f3f3;
    font-size: 14px;
}

.ti-history-table tr:hover {
    background: #fafafa;
}

/* kolumny */
.col-date {
    width: 140px;
    font-size: 13px;
    color: #777;
}

.col-portal {
    width: 120px;
    font-weight: 500;
}

.col-action {
    width: 160px;
    font-size: 13px;
    color: #333;
}

.col-details {
    font-size: 13px;
    color: #555;
}

/* lista szczegółów */
.history-fields {
    margin: 0;
    padding-left: 16px;
}

.history-fields li {
    margin-bottom: 3px;
    font-size: 12px;
    color: #666;
}

.history-value {
    color: #2e7d32;
    font-weight: 500;
    margin-left: 4px;
}

.history-fields {
    margin: 0;
    padding-left: 18px;
}

.history-fields li {
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
}

.history-old,
.history-new {
    display: inline-block;
    margin-left: 6px;
    font-weight: 700;
}

.history-old.is-yes,
.history-new.is-yes {
    color: #2e7d32;
}

.history-old.is-no,
.history-new.is-no {
    color: #c62828;
}

.history-arrow {
    margin: 0 6px;
    color: #777;
    font-weight: 700;
}

.history-value-text {
    margin-left: 6px;
    color: #444;
}

.action-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

/* zgody */
.action-consents_updated {
    background: #e8f5e9;
    color: #2e7d32;
}

/* profil */
.action-profile_updated {
    background: #e3f2fd;
    color: #1565c0;
}

/* dane firmowe */
.action-details_updated {
    background: #fff3e0;
    color: #ef6c00;
}

/* powiązania */
.action-manual_fields_update {
    background: #ede7f6;
    color: #5e35b1;
}

.action-site_disconnect {
    background: #ffebee;
    color: #c62828;
}

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

.site-card-heading h2 {
    margin: 0 0 6px;
}

.site-card-heading p {
    margin: 0;
    color: #666;
}

.site-disconnect-form {
    flex-shrink: 0;
}

.btn-disconnect {
    white-space: nowrap;
}

@media (max-width: 700px) {
    .site-card-top {
        flex-direction: column;
        align-items: stretch;
    }

    .site-disconnect-form {
        width: 100%;
    }

    .btn-disconnect {
        width: 100%;
    }
}

.sites-back-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.sites-back-link h2 {
    margin: 0 0 8px;
}

.sites-back-link p {
    margin: 0;
    color: #666;
}

.sites-back-card:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
}



.site-role-badge-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0 18px;
}

.site-domain-badge,
.site-role-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.site-domain-badge {
    background: #e6f7ec;
    color: #1e7e34;
}

.site-role-badge {
    background: #eef3ff;
    color: #23408e;
}

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

.settings-card {
    height: 100%;
}

.settings-card-danger {
    border: 1px solid rgba(198, 40, 40, 0.15);
}

.settings-link-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.settings-link-card:hover {
    transform: translateY(-2px);
}

.settings-link-card h2 {
    margin: 0 0 10px;
}

.settings-link-card p {
    margin: 0;
    color: #666;
}

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

.footer-sep {
    margin: 0 8px;
    opacity: 0.6;
}


.form-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.form-actions-row form {
    margin: 0;
}

