:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --accent: #06b6d4;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #4f46e5;
    --body-bg: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --transition: 0.2s ease;
}

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

body {
    font-family: var(--font);
    background-color: var(--body-bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ── Navbar (strony publiczne) ── */

.guest-navbar {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
}

.brand-icon {
    border-radius: 0.45rem;
    flex-shrink: 0;
}

.guest-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text) !important;
    letter-spacing: -0.02em;
}

.guest-navbar .navbar-brand span,
.sidebar-brand span {
    color: var(--primary-light);
}

.guest-navbar .nav-link {
    color: var(--text-muted) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem !important;
    border-radius: 0.5rem;
    transition: var(--transition);
}

.guest-navbar .nav-link:hover {
    color: var(--primary) !important;
    background: rgba(79, 70, 229, 0.06);
}

.guest-navbar .btn-nav-cta {
    background: var(--primary);
    color: #fff !important;
    border-radius: 0.5rem;
    padding: 0.5rem 1.25rem !important;
    margin-left: 0.5rem;
}

.guest-navbar .btn-nav-cta:hover {
    background: var(--primary-dark);
    color: #fff !important;
}

/* ── Hero (strona główna) ── */

.hero {
    position: relative;
    padding: 5rem 0 6rem;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(79, 70, 229, 0.12), transparent),
        radial-gradient(ellipse 50% 40% at 90% 60%, rgba(6, 182, 212, 0.08), transparent);
    pointer-events: none;
}

.hero-badge {
    display: inline-block;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 2rem;
    margin-bottom: 1.25rem;
    letter-spacing: 0.02em;
}

.hero h1 {
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--text);
}

.hero .lead {
    font-size: 1.15rem;
    line-height: 1.7;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions .btn {
    padding: 0.75rem 1.75rem;
    font-weight: 600;
    border-radius: 0.625rem;
}

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

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--border);
    background: var(--surface);
}

.btn-outline-primary:hover {
    background: rgba(79, 70, 229, 0.06);
    border-color: var(--primary);
    color: var(--primary);
}

.features {
    padding: 3rem 0 5rem;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    height: 100%;
    transition: var(--transition);
}

.feature-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 1rem;
}

.feature-icon.purple { background: rgba(79, 70, 229, 0.1); color: var(--primary); }
.feature-icon.cyan   { background: rgba(6, 182, 212, 0.1); color: var(--accent); }
.feature-icon.green  { background: rgba(16, 185, 129, 0.1); color: #10b981; }

.feature-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
}

/* ── Karty logowania / rejestracji ── */

.auth-wrapper {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    padding: 3rem 0;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.auth-card .card-body {
    padding: 2.5rem !important;
}

.auth-card h2 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-card .form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text);
}

.auth-card .form-control {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.auth-card .form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.auth-card .btn-primary {
    padding: 0.7rem;
    font-weight: 600;
    border-radius: 0.5rem;
}

.auth-card a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
}

.auth-card a:hover {
    color: #fff;
}

.auth-card p a,
.auth-card p a:hover {
    color: var(--primary);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: #94a3b8;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-card .btn-facebook,
.auth-card .btn-facebook:hover {
    color: #fff;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
}

/* ── Layout aplikacji (sidebar) ── */

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

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand a {
    font-weight: 800;
    font-size: 1.2rem;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.sidebar-user {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sidebar-active);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user-name {
    color: #f1f5f9;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.3;
}

.sidebar-user-email {
    color: #64748b;
    font-size: 0.75rem;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    flex: 1;
}

.sidebar-nav-group-label {
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.85rem 0.875rem 0.35rem;
    list-style: none;
}

.sidebar-nav-group-label:not(:first-child) {
    margin-top: 0.35rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.posts-content-narrow {
    max-width: 760px;
}

.posts-composer-followup {
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.sidebar-nav .nav-link {
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    margin-bottom: 0.15rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    transition: var(--transition);
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    color: #e2e8f0;
    background: var(--sidebar-hover);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--sidebar-active);
}

.sidebar-nav .nav-link.logout {
    color: #f87171;
    margin-top: 0.5rem;
}

.sidebar-nav .nav-link.logout:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #fca5a5;
}

.sidebar-footer {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: auto;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.sidebar-footer a:hover {
    color: #94a3b8;
}

.sidebar-footer a i {
    font-size: 0.95rem;
}

.sidebar-footer a + a {
    margin-top: 0.35rem;
}

.account-details dt {
    color: var(--text-muted);
    font-weight: 500;
}

.account-danger-card .card-header {
    background: rgba(220, 53, 69, 0.06);
}

.app-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--text);
}

.active-page-select {
    min-width: 220px;
}

.active-page-select .form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.active-page-select .form-select {
    font-size: 0.875rem;
    font-weight: 500;
    border-color: var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
}

.active-page-select .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.page-body {
    padding: 1.75rem 2rem 2.5rem;
    flex: 1;
}

/* ── Karty i komponenty panelu ── */

.card {
    background: var(--surface);
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--border) !important;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 1rem 1.25rem !important;
    color: var(--text);
}

.card-body {
    padding: 1.25rem !important;
}

#page-profile-form .form-control:disabled {
    background-color: #f1f3f5;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 1;
}

#page-profile-form .form-control.js-auto-resize-about {
    resize: none;
    overflow: hidden;
    min-height: calc(1.5em + 0.75rem + 2px);
    field-sizing: content;
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.06;
    transform: translate(20%, -20%);
}

.stat-card.stat-pages::after  { background: var(--primary); }
.stat-card.stat-facebook::after { background: #1877f2; }

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1;
}

.stat-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ── Lista fanpage'ów ── */

.page-list-item {
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 1rem 0 !important;
    transition: var(--transition);
}

.page-list-item:last-child {
    border-bottom: none !important;
}

.page-list-item:hover {
    background: rgba(79, 70, 229, 0.03);
}

.page-list-item img {
    border: 2px solid var(--border);
}

.page-card {
    transition: var(--transition);
}

.page-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.page-card img,
.page-avatar {
    border: 2px solid var(--border);
    object-fit: cover;
    image-rendering: auto;
}

/* ── Opublikowane posty (jak Panel Afiliacyjny) ── */

.posts-content {
    padding: 0;
}

.avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e4e6eb;
    color: #1877f2;
    flex-shrink: 0;
}

.posts-composer .card-header,
.posts-scheduled-card .card-header {
    background: var(--surface-alt, #f8fafc);
    font-size: 0.9rem;
}

.posts-composer-status {
    min-height: 1.25rem;
}

.posts-composer-status.is-error {
    color: #dc2626;
}

.posts-composer-status.is-success {
    color: #16a34a;
}

.posts-scheduled-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.posts-scheduled-table td {
    font-size: 0.875rem;
    vertical-align: middle;
}

.badge.posts-status-scheduled {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge.posts-status-failed {
    background: #fee2e2;
    color: #b91c1c;
}

.posts-sync-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.posts-sync-status {
    margin-bottom: 1rem;
}

.posts-sync-status-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.posts-sync-spin {
    animation: posts-sync-rotate 1s linear infinite;
}

@keyframes posts-sync-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.posts-content .planned-posts-table {
    width: 100%;
    font-size: 14px;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 0 0 1px rgba(209, 213, 219, 0.8);
}

.posts-empty-info {
    font-size: 14px;
    color: #6b7280;
    margin: 8px;
}

.posts-feed-loader {
    padding: 1.25rem 1rem 0.5rem;
}

.posts-feed-loader-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.posts-feed-loader-dots {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.posts-feed-loader-dots span {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #1877f2;
    animation: posts-feed-dot 1.2s ease-in-out infinite;
}

.posts-feed-loader-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.posts-feed-loader-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes posts-feed-dot {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.dzien {
    display: flex;
    border: solid 1px #e5e7eb;
    flex-wrap: wrap;
}

.data {
    width: 100%;
    background-color: #e4ecff;
    font-weight: bold;
    padding: 5px 10px;
    font-size: 14px;
    color: #111827;
}

.post {
    padding: 5px;
    border-radius: 4px;
    margin: 8px;
    position: relative;
    border: 1px solid #e0e0e0;
    margin-bottom: 12px;
    background: #fff;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
    margin-bottom: 10px;
    gap: 8px;
}

.post-name-link {
    color: #1877f2;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
}

.post-name-link:hover {
    text-decoration: underline;
}

.post-name-link i {
    font-size: 11px;
}

.post-time {
    color: #65676b;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
}

.post-message {
    font-size: 14px;
    line-height: 1.55;
    color: #050505;
    margin-bottom: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-content {
    display: flex;
    gap: 15px;
}

.post-left {
    flex-shrink: 0;
}

.post-right {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.posts-thumb-btn {
    position: relative;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: block;
    height: 100%;
}

.posts-thumb {
    display: block;
    height: 100%;
    width: 100px;
    max-height: 130px;
    object-fit: cover;
    border-radius: 6px;
}

.post-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 28px;
    pointer-events: none;
}

.posts-thumb-slot {
    width: 100px;
    min-height: 80px;
    max-height: 130px;
}

.posts-thumb-loader {
    width: 100px;
    min-height: 80px;
    max-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 6px;
}

.posts-thumb-loader-dots {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.posts-thumb-loader-dots span {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: #1877f2;
    animation: posts-feed-dot 1.2s ease-in-out infinite;
}

.posts-thumb-loader-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.posts-thumb-loader-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

.posts-no-thumb {
    font-size: 12px;
    color: #9ca3af;
    width: 100px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #f9fafb;
    border-radius: 6px;
}

.post-stats {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

.post-stats i {
    width: 22px;
    display: inline-block;
    color: #00000059;
}

.post-stats hr {
    margin: 6px 0;
    border: none;
    border-top: 1px solid #e5e7eb;
}

.post-options-wrap {
    margin-top: auto;
    padding-top: 8px;
}

.btn-post-options {
    background: #e4e6eb;
    color: #050505;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-post-options:hover {
    background: #d8dadf;
}

.posts-load-more {
    text-align: center;
    padding: 1.25rem 0 0.5rem;
}

.posts-media-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.92);
}

.posts-media-lightbox.is-open {
    display: flex;
}

.posts-media-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 2;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.85;
}

.posts-media-lightbox-close:hover {
    opacity: 1;
}

.posts-media-lightbox-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
}

.posts-media-lightbox-img,
.posts-media-lightbox-video {
    max-width: calc(100vw - 48px);
    width: auto;
    height: calc(100vh - 48px);
    max-height: calc(100vh - 48px);
    object-fit: contain;
    border-radius: 8px;
    background: #000;
}

body.posts-lightbox-open {
    overflow: hidden;
}

@media (max-width: 575.98px) {
    .post-content {
        flex-direction: column;
    }

    .posts-thumb {
        width: 100%;
        max-height: 200px;
    }
}

/* ── Alerty ── */

.flash-container {
    padding: 0 2rem;
    margin-top: 1rem;
}

.alert {
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger  { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info    { background: #eff6ff; color: #1e40af; }

/* ── Przyciski ── */

.btn {
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    transition: var(--transition);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
}

.btn-facebook {
    background: #1877f2;
    border-color: #1877f2;
    color: #fff;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-facebook:hover {
    background: #166fe5;
    border-color: #166fe5;
    color: #fff;
}

/* ── Formularze w panelu ── */

.page-body .form-control,
.page-body textarea.form-control {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

.page-body .form-control:focus,
.page-body textarea.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* ── Polityka prywatności ── */

.legal-page {
    padding: 3rem 0 4rem;
}

.legal-page-inner {
    max-width: 760px;
    margin: 0 auto;
}

.legal-page-header {
    margin-bottom: 2.5rem;
}

.legal-page-header h1 {
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.legal-page-meta {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.95rem;
}

.legal-page section {
    margin-bottom: 2rem;
}

.legal-page h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.legal-page h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem;
}

.legal-page p,
.legal-page li {
    color: var(--text-muted);
    line-height: 1.7;
}

.legal-page ul {
    padding-left: 1.25rem;
}

.legal-page a {
    color: var(--primary);
}

.legal-page code {
    font-size: 0.85em;
    background: var(--surface-2);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.legal-table {
    width: 100%;
    font-size: 0.9rem;
    border-collapse: collapse;
}

.legal-table th,
.legal-table td {
    border: 1px solid var(--border);
    padding: 0.65rem 0.75rem;
    text-align: left;
    vertical-align: top;
}

.legal-table th {
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text);
}

.legal-page-footer {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* ── Strona 404 ── */

.error-page {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-page h1 {
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.04em;
}

/* ── Responsywność ── */

/* ── Wiadomości Messenger ── */

.app-content:has(#messages-page) {
    height: 100vh;
    overflow: hidden;
}

.page-body:has(#messages-page) {
    padding: 1rem 2rem 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.messages-content {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.messages-inbox {
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.messages-inbox .card-body,
.messages-inbox.card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.messages-inbox-inner {
    display: flex;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.messages-sidebar {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.messages-sidebar-header {
    padding: 1rem 1.25rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.messages-sidebar-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.messages-conv-list {
    display: flex;
    flex-direction: column;
}

.messages-conv-item {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    text-align: left;
    padding: 0.875rem 1.25rem;
    transition: var(--transition);
}

.messages-conv-item:hover,
.messages-conv-item.is-active {
    background: #f8fafc;
}

.messages-conv-item.is-active {
    box-shadow: inset 3px 0 0 var(--primary);
}

.messages-conv-item-top,
.messages-conv-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.messages-conv-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.messages-conv-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.messages-conv-snippet {
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.messages-conv-unread {
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.35rem;
}

.messages-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.messages-placeholder {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 2rem;
    text-align: center;
    overflow: hidden;
}

.messages-placeholder i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.messages-thread {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.messages-thread-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.messages-thread-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f8fafc;
}

.messages-bubble {
    max-width: 75%;
    padding: 0.65rem 0.9rem;
    border-radius: 1rem;
    font-size: 0.9rem;
}

.messages-bubble--in {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--border);
}

.messages-bubble--out {
    align-self: flex-end;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
}

.messages-bubble-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.messages-reply-wrap {
    border-top: 1px solid var(--border);
    padding: 1rem 1.25rem;
    background: var(--surface);
    flex-shrink: 0;
}

.messages-reply-form textarea {
    resize: vertical;
    max-height: 120px;
}

.messages-reply-status {
    min-height: 1.25rem;
}

.messages-empty {
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 1rem 1.25rem;
    margin: 0;
}

.messages-load-older-wrap {
    display: flex;
    justify-content: center;
    padding: 0.25rem 0 0.75rem;
}

/* ── Komentarze ── */

.comments-content {
    padding: 0;
}

.comments-filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.comments-panel {
    overflow: hidden;
}

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

.comments-table {
    margin: 0;
    font-size: 0.875rem;
}

.comments-table thead th {
    background: var(--surface-alt, #f8f9fa);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.75rem 1rem;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
}

.comments-table tbody td {
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    vertical-align: top;
}

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

.comments-row--skipped {
    opacity: 0.85;
}

.comments-row--hidden,
.comments-row--deleted {
    opacity: 0.7;
}

.comments-col-date {
    min-width: 7.5rem;
    white-space: nowrap;
}

.comments-col-date time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.comments-col-post {
    width: 6.5rem;
}

.comments-post-link {
    align-items: center;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-align: center;
    text-decoration: none;
}

.comments-post-link:hover .comments-post-link-label {
    color: var(--primary);
}

.comments-post-thumb {
    border-radius: 6px;
    height: 56px;
    object-fit: cover;
    width: 56px;
}

.comments-post-thumb--empty {
    align-items: center;
    background: var(--surface-alt, #f1f3f5);
    border: 1px dashed var(--border);
    color: var(--text-muted);
    display: flex;
    font-size: 1.25rem;
    justify-content: center;
}

.comments-post-link-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.2;
}

.comments-col-message {
    min-width: 14rem;
}

.comments-author {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.comment-reply-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    margin-left: 0.35rem;
    text-transform: uppercase;
}

.comments-text {
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0 0 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.comments-attachment-link {
    display: inline-block;
}

.comments-attachment {
    border-radius: 6px;
    display: block;
    max-height: 120px;
    max-width: 180px;
    object-fit: cover;
}

.comments-col-reply {
    min-width: 12rem;
    width: 14rem;
}

.comments-reply-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comments-reply-input {
    font-size: 0.8rem;
    min-height: 4.5rem;
    resize: vertical;
}

.comments-reply-btn {
    align-self: flex-start;
}

.comments-col-actions {
    min-width: 7rem;
    width: 8rem;
}

.comments-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.comments-actions .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
}

.comments-empty {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
    padding: 2rem 1.25rem;
    text-align: center;
}

@media (max-width: 991.98px) {
    .comments-table thead {
        display: none;
    }

    .comments-table tbody tr {
        display: block;
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 0;
    }

    .comments-table tbody td {
        border: none;
        display: block;
        padding: 0.5rem 1rem;
    }

    .comments-table tbody td::before {
        color: var(--text-muted);
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        font-weight: 600;
        letter-spacing: 0.03em;
        margin-bottom: 0.35rem;
        text-transform: uppercase;
    }

    .comments-col-post {
        width: auto;
    }

    .comments-post-link {
        flex-direction: row;
        justify-content: flex-start;
    }

    .comments-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 991.98px) {
    .page-body:has(#messages-page) {
        padding: 0.75rem 1rem;
    }

    .messages-inbox-inner {
        flex-direction: column;
    }

    .messages-sidebar {
        width: 100%;
        height: 38%;
        max-height: 280px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .messages-main {
        height: 62%;
        flex: 1;
    }
}

@media (max-width: 767.98px) {
    .sidebar {
        width: 100%;
        position: relative;
        min-height: auto;
    }

    .app-content {
        margin-left: 0;
    }

    .app-layout {
        flex-direction: column;
    }

    .page-header,
    .page-body,
    .flash-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .hero {
        padding: 3rem 0 4rem;
    }

    .hero h1 {
        font-size: 2rem;
    }
}