:root {
    /* Premium Light Theme Colors */
    --bg-main: #f4f7f6;
    /* Soft, clean background */
    --bg-glass: rgba(255, 255, 255, 0.75);
    --border-glass: rgba(255, 255, 255, 0.6);
    --text-primary: #1a202c;
    --text-secondary: #718096;

    /* Orange Brand Colors */
    --orange-primary: #FF6600;
    --orange-hover: #e55c00;
    --orange-light: #fff0e5;

    /* Utility Colors */
    --success: #38a169;
    --radius-lg: 24px;
    --radius-md: 12px;

    /* Premium Shadows */
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.02);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    /* Subtle background texture/pattern for clinical premium feel */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 102, 0, 0.04) 0%, transparent 25%),
        radial-gradient(circle at 90% 80%, rgba(0, 102, 255, 0.02) 0%, transparent 25%);
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-soft);
    border-radius: var(--radius-lg);
}

/* Utility */
.hidden {
    display: none !important;
}

.dashboard-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    padding: 1.5rem;
    gap: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* === LOGIN SCREEN === */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, #fff5f0, #ffffff);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    text-align: center;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
}

.login-header {
    margin-bottom: 2.5rem;
}

.login-logo {
    margin-bottom: 0.75rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.login-form {
    text-align: left;
}

.login-error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    text-align: center;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1.25rem;
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.input-wrapper input {
    width: 100%;
    padding: 1rem 1rem 1rem 3.5rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: white;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 4px rgba(255, 102, 0, 0.1);
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    font-size: 0.85rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.forgot-password {
    color: var(--orange-primary);
    font-weight: 600;
    text-decoration: none;
}

.btn-login {
    width: 100%;
    padding: 1.15rem;
    font-size: 1rem;
    font-weight: 600;
    justify-content: center;
    gap: 0.75rem;
    border-radius: 14px;
}

.login-footer {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.login-footer p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.date-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    padding: 0.6rem 1rem;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.date-picker-wrapper:hover {
    border-color: rgba(0, 0, 0, 0.15);
    background: #fcfcfc;
}

.date-picker-wrapper i {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.date-picker-wrapper input {
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    width: 160px;
    min-width: 160px;
    outline: none;
    pointer-events: none;
    /* Kliknięcie idzie do wrappera */
}

.date-picker-wrapper i.ph-caret-down {
    font-size: 0.9rem;
    opacity: 0.6;
}

.report-refresh-status {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    min-width: 24px;
    min-height: 46px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    visibility: hidden;
}

.report-refreshing .report-refresh-status {
    visibility: visible;
}

.report-refresh-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--orange-light);
    border-top-color: var(--orange-primary);
    flex: 0 0 auto;
    animation: reportSpinner 0.8s linear infinite;
}

.report-refreshing .date-picker-wrapper {
    border-color: rgba(255, 102, 0, 0.22);
    background: #fffaf5;
    cursor: progress;
}

.report-data-error {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid #fecaca;
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    background: #fff7f7;
    color: var(--text-primary);
}

.report-data-error > .ph-warning-circle {
    color: #dc2626;
    font-size: 1.45rem;
}

.report-data-error strong {
    display: block;
    font-size: 0.95rem;
}

.report-data-error p {
    margin: 0.2rem 0 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
}

.report-data-failed .view-section {
    display: none !important;
}

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

/* === Sidebar === */
.sidebar {
    padding: 2.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3rem);
    position: sticky;
    top: 1.5rem;
}

.logo {
    margin-bottom: 3.5rem;
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--orange-primary);
    font-weight: 400;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item i {
    font-size: 1.35rem;
}

.nav-item:hover {
    background: white;
    box-shadow: var(--shadow-sm);
    color: var(--orange-primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--orange-primary);
    color: white;
    box-shadow: 0 8px 20px rgba(255, 102, 0, 0.25);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.avatar {
    width: 42px;
    height: 42px;
    background: var(--orange-light);
    color: var(--orange-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-info .name {
    font-size: 0.95rem;
    font-weight: 600;
}

.user-info .role {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.logout-button {
    margin-left: auto;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-button:hover {
    color: var(--orange-primary);
    border-color: rgba(255, 102, 0, 0.24);
    background: #fff7f0;
}

.logout-button:disabled {
    cursor: progress;
    opacity: 0.7;
}

/* === Main Content === */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2.5rem;
}

.header-title h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-title .subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--orange-primary);
    color: white;
    box-shadow: 0 6px 15px rgba(255, 102, 0, 0.2);
}

.btn-primary:hover {
    background: var(--orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 102, 0, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.1);
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.kpi-card {
    padding: 1.75rem;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.05);
}

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--orange-light);
    color: var(--orange-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.kpi-data {
    display: flex;
    flex-direction: column;
}

.kpi-data h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.kpi-data .value {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1;
    letter-spacing: -1px;
}

.kpi-data .value.text-sm {
    font-size: 1.25rem;
    letter-spacing: 0;
}

.trend {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
}

.trend.positive {
    color: var(--success);
}

.trend.neutral {
    color: var(--text-secondary);
}

.trend.negative {
    color: #e53e3e;
}

.trend.warning {
    color: #dd6b20;
}

.orange-gradient {
    background: linear-gradient(135deg, var(--orange-primary) 0%, #ff8c42 100%);
    color: white;
    border: none;
}

.orange-gradient .text-white {
    width: 100%;
}

.orange-gradient h3 {
    color: rgba(255, 255, 255, 0.85);
}

.orange-gradient .trend {
    color: rgba(255, 255, 255, 0.95);
}

.orange-gradient .value {
    color: white;
}

/* Charts Config */
.charts-grid {
    display: grid;
    grid-template-columns: minmax(360px, 0.78fr) minmax(0, 1.72fr);
    gap: 1.5rem;
    align-items: stretch;
}

.chart-card {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.card-header > div {
    min-width: 0;
}

.chart-subtitle {
    margin-top: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.45;
}

.icon-btn {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.4rem;
    border-radius: 8px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
    color: var(--orange-primary);
    border-color: var(--orange-primary);
}

.chart-container {
    flex-grow: 1;
    position: relative;
    width: 100%;
    min-height: 280px;
}

.traffic-efficiency-container {
    min-height: 320px;
}

.traffic-ranking {
    display: grid;
    align-content: center;
    gap: 1rem;
    flex: 1;
    min-height: 320px;
}

.traffic-ranking-row {
    min-width: 0;
}

.traffic-ranking-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}

.traffic-ranking-name {
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.traffic-ranking-values {
    display: grid;
    grid-template-columns: minmax(2rem, auto) 3.25rem;
    align-items: baseline;
    gap: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.traffic-ranking-values strong {
    color: var(--text-primary);
    font-size: 0.82rem;
}

.traffic-ranking-track {
    display: block;
    width: 100%;
    height: 7px;
    overflow: hidden;
    background: #edf2f7;
    border-radius: 3px;
}

.traffic-ranking-fill {
    display: block;
    height: 100%;
    background: var(--orange-primary);
    border-radius: inherit;
    transform-origin: left center;
    animation: trafficRankGrow 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: var(--ranking-delay, 0ms);
}

.traffic-ranking-row:not(:first-child) .traffic-ranking-fill {
    background: #94a3b8;
}

.traffic-ranking-row.is-rest .traffic-ranking-name,
.traffic-ranking-row.is-rest .traffic-ranking-values strong {
    color: var(--text-secondary);
}

.traffic-ranking-row.is-rest .traffic-ranking-fill {
    background: #cbd5e1;
}

.traffic-ranking-empty {
    align-self: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
}

@keyframes trafficRankGrow {
    from {
        opacity: 0.55;
        transform: scaleX(0.15);
    }

    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .traffic-ranking-fill {
        animation: none;
    }
}

/* Data Table */
.table-section {
    padding: 2rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    padding: 0.6rem 1.25rem;
    border-radius: 100px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    width: 350px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.search-box i {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.search-box input {
    border: none;
    outline: none;
    background: none;
    width: 100%;
    font-size: 0.95rem;
    font-family: inherit;
}

.table-container {
    overflow-x: auto;
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 1.15rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

th {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #fafbfc;
    padding: 1.15rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

th.sortable {
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

th.sortable:hover {
    background: #f1f5f9;
    color: var(--orange-primary);
}

/* Flexbox for icons next to text */
th.sortable {
    display: table-cell; /* Default, overridden in internal content if needed */
}

/* We need a wrapper or styling the text+icon inside th */
th.sortable {
    position: relative;
    padding-right: 2.5rem; /* Space for icon */
}

th.sortable i {
    position: absolute;
    right: 1.15rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    transition: all 0.2s;
    opacity: 0.5;
}

th.sortable:hover i {
    opacity: 1;
    color: var(--orange-primary);
}

th.sortable.asc i, th.sortable.desc i {
    opacity: 1;
    color: var(--orange-primary);
}

th.sortable i.flex-icon {
    position: static;
    transform: none;
}

td {
    font-size: 0.95rem;
    font-weight: 500;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #fdfdfd;
}

.source-badge {
    padding: 0.35rem 0.85rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

#offersTable {
    min-width: 860px;
}

#offersTable th:nth-child(2) {
    width: 36%;
}

.offer-id {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.offer-id-missing,
.offer-title-missing {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #9c4f16;
    font-size: 0.82rem;
    font-weight: 600;
}

.offer-title,
.offer-title-link {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.35;
}

.offer-title-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.offer-title-link:hover {
    color: var(--orange-primary);
}

.offer-title-link:focus-visible {
    outline: 2px solid var(--orange-primary);
    outline-offset: 3px;
    border-radius: 3px;
}

.offer-title-link i {
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.offers-number {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.offer-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 5.25rem;
    font-size: 0.84rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.offer-trend.positive {
    color: var(--success);
}

.offer-trend.negative {
    color: #c53030;
}

.offer-trend.neutral {
    color: var(--text-secondary);
}

.offer-trend.new {
    color: var(--orange-hover);
}

.offer-share {
    display: grid;
    grid-template-columns: minmax(70px, 1fr) 4.25rem;
    align-items: center;
    gap: 0.75rem;
    min-width: 150px;
    font-size: 0.84rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.offer-share-track {
    height: 6px;
    overflow: hidden;
    background: #edf2f7;
    border-radius: 3px;
}

.offer-share-fill {
    height: 100%;
    background: var(--orange-primary);
    border-radius: inherit;
}

.offers-summary-row td {
    background: var(--orange-light);
    font-weight: 700;
}

.offers-summary-row td:first-child {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-align: right;
}

.offers-empty-state {
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
    text-align: center;
}

.badge-mailing {
    background: #EBF4FF;
    color: #3182CE;
}

.badge-cpc {
    background: #FEEBC8;
    color: #DD6B20;
}

.badge-organic {
    background: #C6F6D5;
    color: #38A169;
}

.badge-other {
    background: #EDF2F7;
    color: #718096;
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .link-checker-top-grid {
        grid-template-columns: 1fr;
    }
}

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

    .sidebar {
        display: none;
    }

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

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .report-data-error {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .report-data-error .btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .search-box {
        width: 100%;
        margin-top: 1rem;
    }

    .card-header {
        flex-wrap: wrap;
    }

    .link-checker-table-actions,
    .link-search-box,
    .link-filter-select,
    .link-checker-table-actions .btn {
        width: 100%;
    }

    .link-checker-progress-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* === System Zakładek (SPA) === */
.view-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.view-section.active {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#view-client-match.view-section.active {
    gap: 1.5rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Moduł Importu Plików (Drag & Drop) === */
.file-upload-zone {
    border: 2px dashed var(--orange-primary);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    text-align: center;
    background: var(--orange-light);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.file-upload-zone:hover {
    background: #ffe3cd;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 102, 0, 0.15);
}

.file-upload-zone.is-processing {
    cursor: progress;
    background: #fff7ef;
    border-color: rgba(255, 102, 0, 0.65);
    transform: none;
}

.file-upload-zone i {
    font-size: 1.5rem;
    color: var(--orange-primary);
    margin-bottom: 0.25rem;
}

.file-upload-zone .upload-processing-icon {
    font-size: 1.85rem;
}

.file-upload-zone h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.file-upload-zone p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.history-meta {
    display: block;
    margin-top: 0.3rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
}

/* === Link Checker === */
.link-checker-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.9fr);
    gap: 1.5rem;
    align-items: stretch;
}

.link-checker-panel {
    padding: 1.55rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-height: 300px;
}

.link-checker-mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
    padding: 0.25rem;
    background: #edf2f7;
    border-radius: 12px;
}

.link-checker-mode-tab {
    min-height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.link-checker-mode-tab i {
    font-size: 1rem;
}

.link-checker-mode-tab.active {
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.link-checker-textarea {
    flex: 1;
    min-height: 150px;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    outline: none;
    resize: vertical;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.link-checker-textarea:focus {
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 4px rgba(255, 102, 0, 0.1);
}

.link-checker-start {
    justify-content: center;
}

.link-checker-drop-zone {
    min-height: 150px;
    padding: 1.75rem;
    background: #fff2e8;
    border-style: dashed;
    flex: 1;
}

.link-checker-drop-zone.is-dragover {
    background: #ffe3cd;
}

.link-checker-drop-zone input[type="file"] {
    display: none;
}

.link-checker-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.link-checker-kpi-grid .kpi-card {
    min-height: 138px;
    align-items: flex-start;
}

.link-checker-progress {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.link-checker-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.link-checker-progress-track {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #edf2f7;
}

.link-checker-progress-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--orange-primary);
    transition: width 0.2s ease-out, background 0.2s;
}

.link-kpi-ok {
    background: #c6f6d5;
    color: var(--success);
}

.link-kpi-error {
    background: #fed7d7;
    color: #e53e3e;
}

.link-kpi-warning {
    background: #feebc8;
    color: #dd6b20;
}

.link-checker-table-header {
    gap: 1rem;
}

.link-results-heading {
    min-width: 0;
}

#link-results-context.is-preview {
    color: var(--orange-hover);
    font-weight: 700;
}

#link-results-context.is-error {
    color: #c53030;
    font-weight: 700;
}

.link-checker-table-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.link-search-box {
    width: 280px;
}

.link-filter-select {
    padding: 0.58rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: white;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    min-height: 34px;
}

.link-empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 1rem;
}

.link-empty-state i {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--orange-primary);
    font-size: 2rem;
}

.link-url-cell {
    max-width: 560px;
    word-break: break-all;
}

.link-url-cell a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.link-url-cell a:hover {
    color: var(--orange-primary);
}

.link-status-code {
    text-align: center;
}

.link-status-code code {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 800;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-badge.ok {
    color: var(--success);
    background: #e6fffa;
    border: 1px solid #b2f5ea;
}

.status-badge.case-mismatch {
    color: #dd6b20;
    background: #fffaf0;
    border: 1px solid #feebc8;
}

.status-badge.soft-404 {
    color: #b7791f;
    background: #fffdf5;
    border: 1px solid #fef08a;
}

.status-badge.error {
    color: #e53e3e;
    background: #fff5f5;
    border: 1px solid #fed7d7;
}

.link-details-cell {
    color: var(--text-secondary);
    font-size: 0.9rem;
    min-width: 260px;
}

#linkHistoryTable {
    min-width: 820px;
}

.link-history-source {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 260px;
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-history-source i {
    flex: 0 0 auto;
    color: var(--text-secondary);
}

.link-history-ok {
    color: var(--success);
    font-weight: 700;
}

.link-history-error-count {
    color: #c53030;
    font-weight: 700;
}

.link-history-warning-count {
    color: #b45309;
    font-weight: 700;
}

.link-history-actions {
    text-align: right;
    white-space: nowrap;
}

.link-history-action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
}

.link-history-preview:hover:not(:disabled) {
    color: var(--orange-hover);
    border-color: rgba(255, 102, 0, 0.35);
    background: #fff8f2;
}

.link-history-delete {
    color: #c53030;
}

.link-history-delete:hover:not(:disabled) {
    color: #9b2c2c;
    border-color: #fed7d7;
    background: #fff5f5;
}

.link-history-error {
    color: #c53030;
}

.suggestion-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.suggestion-box code {
    background: #edf2f7;
    color: #2d3748;
    padding: 0.25rem 0.45rem;
    border-radius: 6px;
    font-family: Consolas, 'Courier New', monospace;
    word-break: break-all;
}

.btn-fix-url {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 0;
    background: transparent;
    color: var(--orange-primary);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0;
}

.btn-fix-url:hover {
    color: var(--orange-hover);
}

.spinner {
    animation: reportSpinner 0.8s linear infinite;
}

@media (max-width: 1100px) {
    .link-checker-top-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .link-checker-kpi-grid {
        grid-template-columns: 1fr;
    }

    .link-checker-mode-tabs {
        grid-template-columns: 1fr;
    }
}

/* Status dopasowania klienta */
/* === PAGINATION === */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #fcfcfc;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.pagination-info span {
    color: var(--text-main);
    font-weight: 600;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pagination-page {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.pagination-page:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.pagination-page.active {
    background: var(--orange-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.2);
}

.pagination-ellipsis {
    cursor: default;
    color: var(--text-secondary);
}

.pagination-ellipsis:hover {
    background: transparent;
    color: var(--text-secondary);
}

.btn-sm {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    height: 34px;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.08);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: #f8fafc;
    color: var(--text-main);
    border-color: rgba(0,0,0,0.15);
}

.status-match, .status-miss {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 60px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-match {
    background: #E6FFFA;
    color: #047481;
}

.status-miss {
    background: #FFF5F5;
    color: #C53030;
}

.history-actions {
    text-align: right;
}

.verification-delete-run {
    color: #c53030;
}

.verification-delete-run:hover:not(:disabled) {
    color: #9b2c2c;
    border-color: #fed7d7;
    background: #fff5f5;
}

/* Fix for table section with pagination */
.table-section.glass-panel {
    padding-bottom: 0px !important;
}

.table-container {
    margin-bottom: 0px !important;
}

/* === Nowa Karta Zgodność (Quality) === */
.quality-card {
    display: flex !important;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 2rem;
    height: 100%;
}

.quality-icon-container {
    width: 64px;
    height: 64px;
    background: #FFF5F0;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FF6600;
    font-size: 1.75rem;
}

.quality-main {
    flex-grow: 1;
}

.quality-title {
    color: #8C99AF;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 0.75rem;
}

.quality-stats-row {
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* Circular Progress */
.progress-circle {
    position: relative;
    width: 80px;
    height: 80px;
}

.progress-circle svg {
    width: 80px;
    height: 80px;
    transform: rotate(-90deg);
}

.progress-circle circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}

.progress-circle .bg {
    stroke: #EDF2F7;
}

.progress-circle .meter {
    stroke: #38A169;
    stroke-dasharray: 226.2;
    /* 2 * PI * 36 */
    stroke-dashoffset: 226.2;
    transition: stroke-dashoffset 1s ease-out;
}

.progress-circle .value-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.25rem;
    font-weight: 800;
    color: #1A202C;
}

/* Stat Small Boxes */
.stat-box-container {
    display: flex;
    gap: 0.75rem;
}

.stat-box {
    background: #F8FAFC;
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    text-align: center;
    min-width: 70px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.stat-box label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #A0AEC0;
    margin-bottom: 0.25rem;
}

.stat-box span {
    font-size: 1.15rem;
    font-weight: 800;
    color: #2D3748;
}

/* === Flatpickr Advanced Themes (GA4 Style) === */
.flatpickr-calendar {
    font-family: 'Inter', sans-serif !important;
    border: none !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12) !important;
    border-radius: 16px !important;
    padding: 0 !important;
    background: white !important;
    display: flex !important;
    flex-direction: row !important;
    /* Sidebar obok zawartości */
    width: auto !important;
    min-width: 450px !important;
}

/* Nowy wrapper dla prawej strony */
.flatpickr-main-content {
    width: 346px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Sidebar for presets */
.flatpickr-sidebar {
    width: 140px;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f8fafc;
    border-radius: 16px 0 0 16px;
    flex-shrink: 0;
}

.flatpickr-sidebar-item {
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.flatpickr-sidebar-item:hover {
    background: #edf2f7;
    color: var(--text-primary);
}

.flatpickr-sidebar-item.active {
    background: var(--orange-light);
    color: var(--orange-primary);
}

/* Footer for Apply button */
.flatpickr-footer {
    width: 100%;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: flex-end;
    background: white;
    border-radius: 0 0 16px 0;
}

.flatpickr-btn-apply {
    background: var(--orange-primary);
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.flatpickr-btn-apply:hover {
    background: #e65c00;
    transform: translateY(-1px);
}

/* Main Calendar Overrides */
.flatpickr-innerContainer {
    width: 100%;
    padding: 0 0.75rem 0.5rem 0.75rem;
    flex-grow: 1;
}

.flatpickr-months {
    display: flex;
    padding: 10px 0;
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.flatpickr-month {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px !important;
}

.flatpickr-current-month {
    position: static !important;
    width: auto !important;
    display: flex !important;
    align-items: center;
    gap: 1px;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    font-size: 1rem !important;
}

.flatpickr-current-month .cur-month {
    font-weight: 700 !important;
    margin-right: 0 !important;
}

.flatpickr-current-month .cur-year {
    font-weight: 700 !important;
    color: var(--text-secondary);
}

.flatpickr-day.inRange,
.flatpickr-day.prevMonthDay.inRange,
.flatpickr-day.nextMonthDay.inRange,
.flatpickr-day.today.inRange,
.flatpickr-day.prevMonthDay.today.inRange,
.flatpickr-day.nextMonthDay.today.inRange {
    background: #fff5eb !important;
    border-color: #fff5eb !important;
    box-shadow: none !important;
    color: var(--orange-primary) !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--orange-primary) !important;
    border-color: var(--orange-primary) !important;
    color: white !important;
}

.flatpickr-day {
    max-width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    border-radius: 8px !important;
    margin: 2px !important;
}

.flatpickr-day.selected.startRange+.endRange:before,
.flatpickr-day.startRange.startRange+.endRange:before {
    display: none;
}

/* Range Connectors Styling */
.flatpickr-day.inRange {
    border-radius: 0 !important;
}

.flatpickr-day.startRange {
    border-radius: 8px 0 0 8px !important;
}

.flatpickr-day.endRange {
    border-radius: 0 8px 8px 0 !important;
}

/* Header Arrows */
.flatpickr-prev-month,
.flatpickr-next-month {
    top: 10px !important;
    /* Dopasowanie do padding-top: 10px w .flatpickr-months */
    height: 34px !important;
    /* Taka sama wysokość jak .flatpickr-month */
    display: flex !important;
    align-items: center;
    padding: 0 10px !important;
}

.flatpickr-prev-month:hover svg,
.flatpickr-next-month:hover svg {
    fill: var(--orange-primary) !important;
}

/* === Sortable Table Headers === */
th.sortable {
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    position: relative;
}

th.sortable:hover {
    color: var(--orange-primary);
    background: #f1f5f9;
}

th.sortable i {
    margin-left: 4px;
    font-size: 0.85em;
    color: #cbd5e0;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s;
    display: inline-block;
}

th.sortable.asc i,
th.sortable.desc i {
    color: var(--orange-primary);
}

th.sortable.asc i {
    transform: rotate(180deg);
}
