:root {
    --primary: #F57C00;
    --primary-hover: #d96e00;

    --dark: #1A1A1A;
    --black: #0D0D0D;
    --white: #FFFFFF;

    --bg: #FFFFFF;
    --surface: #F7F7F8;
    --surface-light: #FFFFFF;
    --border: #F0F0F0;

    --text: #1A1A1A;
    --text-muted: #6B7280;

    --danger: #dc2626;

    --radius: 0;
    --shadow: none;

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: var(--font-main);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

/* =========================
   AUTH / LOGIN
========================= */

.auth-body {
    min-height: 100vh;
    background: var(--black);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 520px;
}

.auth-page::before {
    content: "";
    display: block;
    background:
        linear-gradient(rgba(13, 13, 13, 0.35), rgba(13, 13, 13, 0.85)),
        radial-gradient(circle at 20% 20%, rgba(245, 124, 0, 0.4), transparent 28%),
        linear-gradient(135deg, #1A1A1A 0%, #0D0D0D 100%);
}

.auth-card {
    width: 100%;
    min-height: 100vh;
    padding: 64px 54px;
    background: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid var(--border);
}

.auth-brand {
    display: grid;
    gap: 22px;
    margin-bottom: 42px;
}

.auth-logo,
.sidebar-logo {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: var(--white);
    background: var(--primary);
    border-radius: 0;
    text-transform: uppercase;
}

.auth-brand h1 {
    margin: 0;
    font-size: 3.2rem;
    line-height: 1;
    letter-spacing: -0.06em;
    color: var(--black);
}

.auth-brand p {
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 1rem;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.auth-form label {
    display: grid;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark);
}

.auth-form input,
.filters input,
.filters select {
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 0 14px;
    background: var(--surface);
    color: var(--text);
    outline: none;
}

.filters input[type="text"] {
    min-width: 260px;
}

.auth-form input:focus,
.filters input:focus,
.filters select:focus {
    border-color: var(--primary);
    background: var(--white);
}

.alert {
    padding: 13px 14px;
    border-radius: 0;
    margin-bottom: 22px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.alert-danger {
    background: #fff1f1;
    color: #991b1b;
    border-color: #fecaca;
}

/* =========================
   BUTTONS
========================= */

.btn {
    min-height: 42px;
    border-radius: 0;
    padding: 0 18px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

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

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

.btn-light {
    color: var(--dark);
    background: var(--white);
    border-color: var(--border);
}

.btn-light:hover {
    border-color: var(--dark);
}

.btn-full {
    width: 100%;
    height: 48px;
}

/* =========================
   APP LAYOUT
========================= */

.app-body {
    background: var(--bg);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
    background: var(--black);
    color: var(--white);
    padding: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid #242424;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
    border-radius: 999px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.42);
}

.sidebar-nav,
.sidebar-menu {
    padding-bottom: 40px;
}

.sidebar-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid #242424;
    margin-bottom: 22px;
}

.sidebar-brand strong {
    display: block;
    font-size: 1.2rem;
    line-height: 1.1;
    color: var(--white);
    letter-spacing: -0.03em;
}

.sidebar-brand span {
    display: block;
    margin-top: 4px;
    font-size: 0.78rem;
    color: #A3A3A3;
}

.sidebar-nav {
    display: grid;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 0;
    color: #D4D4D4;
    font-size: 0.9rem;
    font-weight: 600;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--dark);
    color: var(--white);
}

.sidebar-link.active {
    background: var(--dark);
    color: var(--white);
    border-left-color: var(--primary);
}

.sidebar-icon {
    width: 24px;
    text-align: center;
    font-size: 1rem;
}

.main {
    min-width: 0;
    background: var(--white);
}

/* =========================
   TOPBAR
========================= */

.topbar {
    min-height: 96px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 22px 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-eyebrow {
    margin: 0 0 2px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.topbar h1 {
    margin: 0;
    font-size: 3.2rem;
    line-height: 0.95;
    letter-spacing: -0.03em;
    color: var(--black);
}

.topbar-user {
    display: flex;
    gap: 14px;
    align-items: center;
}

.topbar-user strong,
.topbar-user span {
    display: block;
    text-align: right;
}

.topbar-user strong {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
}

.topbar-user span {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* =========================
   CONTENT
========================= */

.content {
    padding: 34px;
}

.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 28px;
}

.page-header-row h2 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.2;
    font-weight: 700;
    color: var(--black);
    letter-spacing: -0.03em;
}

.page-header-row p {
    margin: 7px 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* =========================
   KPI CARDS
========================= */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    padding: 22px;
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kpi-card span {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kpi-card strong {
    display: block;
    font-size: 2rem;
    line-height: 1.05;
    margin: 12px 0 6px;
    letter-spacing: -0.06em;
    color: var(--black);
	letter-spacing: -0.03em;
}

.kpi-card small {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* =========================
   PANELS / CHARTS
========================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
    gap: 22px;
}

.panel {
    min-width: 0;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
}

.panel-large {
    grid-column: span 1;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.2;
    font-weight: 700;
    color: var(--black);
    letter-spacing: -0.03em;
}

.panel-header p {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ApexCharts visual tuning */
.apexcharts-canvas {
    font-family: var(--font-main) !important;
}

.apexcharts-tooltip {
    border-radius: 0 !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
}

.apexcharts-tooltip-title {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border) !important;
}

/* =========================
   TABLES
========================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    background: var(--surface);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

th {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
}

td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--dark);
}

td strong {
    display: block;
    font-weight: 600;
    color: var(--black);
}

td span {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 2px;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 0;
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--dark);
    font-weight: 600;
    font-size: 0.75rem;
}

/* =========================
   EMPTY / STATES
========================= */

.empty-state {
    padding: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-align: center;
}

.empty-state h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}

.empty-state p {
    margin: 0;
    color: var(--text-muted);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .topbar h1 {
        font-size: 2.6rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 820px) {
    .auth-page {
        display: block;
    }

    .auth-page::before {
        display: none;
    }

    .auth-card {
        min-height: 100vh;
        padding: 34px 24px;
        border-left: 0;
    }

    .auth-brand h1 {
        font-size: 2.6rem;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        height: auto;
        position: relative;
        padding: 18px;
    }

    .sidebar-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar {
        position: relative;
        min-height: auto;
        padding: 22px;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar h1 {
        font-size: 2.4rem;
    }

    .topbar-user {
        justify-content: space-between;
    }

    .topbar-user strong,
    .topbar-user span {
        text-align: left;
    }

    .content {
        padding: 22px;
    }

    .page-header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filters {
        width: 100%;
    }

    .filters input,
    .filters select,
    .filters button {
        width: 100%;
    }

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

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

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

    .auth-brand h1 {
        font-size: 2.2rem;
    }

    .kpi-card strong {
        font-size: 1.7rem;
    }
}

.categories-table select {
    width: 100%;
    min-width: 220px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--white);
    color: var(--text);
    padding: 0 10px;
    font-size: 0.88rem;
}

.categories-table select:focus {
    outline: none;
    border-color: var(--primary);
}

.categories-table select:disabled {
    background: #EFEFF0;
    color: var(--text-muted);
    cursor: not-allowed;
}

.categories-table .btn {
    min-height: 38px;
}

.status-unmapped {
    color: var(--primary);
    font-weight: 600;
}

.category-map-form {
    margin: 0;
}

.revenue-analysis-grid {
    margin-bottom: 22px;
}

.org-revenue-table .org-row td {
    background: var(--white);
    border-top: 2px solid var(--border);
    font-weight: 600;
}

.org-revenue-table .org-row strong {
    color: var(--black);
    font-size: 0.95rem;
}

.org-revenue-table .department-row td {
    background: var(--surface);
}

.department-indent {
    display: inline-block;
    margin-right: 8px;
    color: var(--primary);
    font-weight: 600;
}

.content > .panel {
    margin-top: 22px;
}

.content > .dashboard-grid + .panel {
    margin-top: 22px;
}

.revenue-analysis-grid {
    margin-bottom: 22px;
}

.panel-header-with-actions {
    align-items: flex-start;
}

.invoice-search-form input[type="text"] {
    min-width: 360px;
}

.org-revenue-table .org-row td {
    background: var(--white);
    border-top: 2px solid var(--border);
    font-weight: 600;
}

.org-revenue-table .org-row strong {
    color: var(--black);
    font-size: 0.95rem;
}

.org-revenue-table .department-row td {
    background: var(--surface);
}

.department-indent {
    display: inline-block;
    margin-right: 8px;
    color: var(--primary);
    font-weight: 600;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-top: 18px;
    margin-top: 18px;
    border-top: 1px solid var(--border);
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-link {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.pagination-link:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.pagination-link.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.pagination-dots {
    padding: 0 6px;
    color: var(--text-muted);
}

@media (max-width: 820px) {
    .panel-header-with-actions {
        flex-direction: column;
    }

    .invoice-search-form {
        width: 100%;
    }

    .invoice-search-form input[type="text"] {
        min-width: 0;
        width: 100%;
    }

    .pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination-link {
        width: 100%;
    }

    .pagination-pages .pagination-link {
        width: auto;
    }
}

.filters input[type="text"],
.invoice-search-form input[type="text"] {
    background: var(--white);
}

.summary-row td {
    background: var(--white);
    border-top: 2px solid var(--border);
    font-weight: 600;
}

.summary-row strong {
    font-weight: 700;
}

/* =========================
   SALES OPPORTUNITIES MATRIX
========================= */

.sales-opportunities-matrix-wrap {
    width: 100%;
    overflow-x: auto;
}

.sales-opportunities-matrix-table {
    min-width: 1500px;
    border-collapse: collapse;
    table-layout: fixed;
}

.sales-opportunities-matrix-table th,
.sales-opportunities-matrix-table td {
    border: 1px solid #d7d7d7;
    padding: 9px 10px;
    vertical-align: middle;
    font-size: 0.84rem;
}

.sales-opportunities-matrix-table th {
    background: #f5f5f5;
    color: var(--black);
    font-weight: 700;
    text-align: center;
    white-space: normal;
}

.sales-opportunities-matrix-table td {
    background: var(--surface);
}

.sales-opportunities-matrix-table td:first-child strong {
    font-weight: 700;
}

.sales-opportunities-matrix-table th:nth-child(1),
.sales-opportunities-matrix-table td:nth-child(1) {
    width: 190px;
}

.sales-opportunities-matrix-table th:nth-child(2),
.sales-opportunities-matrix-table td:nth-child(2) {
    width: 180px;
}

.sales-opportunities-matrix-table th:nth-child(3),
.sales-opportunities-matrix-table td:nth-child(3) {
    width: 170px;
}

.sales-opportunities-matrix-table th:nth-child(4),
.sales-opportunities-matrix-table td:nth-child(4) {
    width: 170px;
}

.sales-opportunities-matrix-table th:nth-child(5),
.sales-opportunities-matrix-table td:nth-child(5) {
    width: 190px;
}

.sales-opportunities-matrix-table th:nth-child(6),
.sales-opportunities-matrix-table td:nth-child(6) {
    width: 90px;
}

.sales-opportunities-matrix-table th:nth-child(n+7),
.sales-opportunities-matrix-table td:nth-child(n+7) {
    width: 82px;
}

.sales-opportunities-matrix-table tbody tr:hover td {
    background: #fff;
}

.sales-opportunities-matrix-table .text-right {
    text-align: right;
}

/* =========================
   SALES OPPORTUNITIES FILTERS
========================= */

.sales-opportunities-filters {
    align-items: flex-end;
    flex-wrap: wrap;
}

.sales-opportunities-filters label {
    display: grid;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sales-opportunities-filters input,
.sales-opportunities-filters select {
    min-width: 190px;
}

.sales-opportunities-filters input[name="year"] {
    min-width: 120px;
}

/* =========================
   SALES OPPORTUNITIES FILTERS
========================= */

.sales-opportunities-filters {
    align-items: flex-end;
    flex-wrap: wrap;
}

.sales-opportunities-filters label {
    display: grid;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sales-opportunities-filters input,
.sales-opportunities-filters select {
    min-width: 190px;
}

.sales-opportunities-filters input[name="year"] {
    min-width: 120px;
}

/* =========================
   SALES OPPORTUNITIES MATRIX
========================= */

.sales-opportunities-matrix-wrap {
    width: 100%;
    overflow-x: auto;
}

.sales-opportunities-matrix-table {
    width: 100%;
    min-width: 1060px;
    border-collapse: collapse;
    table-layout: fixed;
}

.sales-opportunities-matrix-table th,
.sales-opportunities-matrix-table td {
    border: 1px solid #d7d7d7;
    padding: 8px 9px;
    vertical-align: middle;
    font-size: 0.7rem;
    background: #ffffff;
}

.sales-opportunities-matrix-table th {
    background: #f5f5f5;
    color: var(--black);
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.sales-opportunities-matrix-table td strong {
    font-weight: 700;
}

.sales-opportunities-matrix-table td span {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.6rem;
}

.sales-opportunities-matrix-table th:nth-child(1),
.sales-opportunities-matrix-table td:nth-child(1) {
    width: 210px;
}

.sales-opportunities-matrix-table th:nth-child(2),
.sales-opportunities-matrix-table td:nth-child(2) {
    width: 250px;
    border-left: 1px solid #d7d7d7 !important;
}

.sales-opportunities-matrix-table th:nth-child(3),
.sales-opportunities-matrix-table td:nth-child(3) {
    width: 90px;
}

.sales-opportunities-matrix-table th:nth-child(n+4),
.sales-opportunities-matrix-table td:nth-child(n+4) {
    width: 54px;
}

.sales-opportunities-matrix-table th:last-child,
.sales-opportunities-matrix-table td:last-child {
    width: 70px;
    border-left: 1px solid #d7d7d7 !important;
}

.sales-opportunities-matrix-table .text-right {
    text-align: center;
}

.sales-opportunities-matrix-table th.text-right,
.sales-opportunities-matrix-table td.text-right,
.sales-opportunities-total-cell {
    text-align: center !important;
}

.sales-opportunities-department-cell {
    background: #ffffff !important;
    vertical-align: middle !important;
    border-right: 1px solid #d7d7d7 !important;
}

.sales-opportunities-department-cell strong {
    display: block;
    font-size: 0.75rem;
}

.sales-opportunities-marketplace-service-cell {
    background: #ffffff !important;
    border-left: 1px solid #d7d7d7 !important;
}

.sales-opportunities-row-type {
    text-align: center;
    font-weight: 700;
}

.sales-opportunities-plan-label-cell,
.sales-opportunities-plan-month-cell,
.sales-opportunities-plan-total-cell {
    background: #eeeeef !important;
}

.sales-opportunities-total-cell {
    border-left: 1px solid #d7d7d7 !important;
}

/* realizacja - kolory względem planu */

.sales-opportunities-cell-neutral {
    background: #ffffff !important;
}

.sales-opportunities-cell-future {
    background: #ffffff !important;
}

.sales-opportunities-cell-red {
    background: #f8d7da !important;
    color: #842029 !important;
    font-weight: 500;
}

.sales-opportunities-cell-yellow {
    background: #fff3cd !important;
    color: #664d03 !important;
    font-weight: 500;
}

.sales-opportunities-cell-light-green {
    background: #d1e7dd !important;
    color: #0f5132 !important;
    font-weight: 500;
}

.sales-opportunities-cell-dark-green {
    background: #198754 !important;
    color: #ffffff !important;
    font-weight: 500;
}

/* =========================
   SALES OPPORTUNITIES PLAN EDIT
========================= */

.sales-opportunities-plan-edit-wrap {
    width: 100%;
    overflow-x: auto;
}

.sales-opportunities-plan-edit-table {
    min-width: 1180px;
    table-layout: fixed;
}

.sales-opportunities-plan-edit-table th,
.sales-opportunities-plan-edit-table td {
    border: 1px solid #d7d7d7;
    padding: 8px 9px;
    vertical-align: middle;
}

.sales-opportunities-plan-edit-table th {
    background: #f5f5f5;
    color: var(--black);
    text-align: center;
}

.sales-opportunities-plan-edit-table th:nth-child(1),
.sales-opportunities-plan-edit-table td:nth-child(1) {
    width: 230px;
}

.sales-opportunities-plan-edit-table th:nth-child(2),
.sales-opportunities-plan-edit-table td:nth-child(2) {
    width: 260px;
}

.sales-opportunities-plan-edit-table th:nth-child(n+3),
.sales-opportunities-plan-edit-table td:nth-child(n+3) {
    width: 70px;
}

.sales-opportunities-plan-edit-table input[type="number"] {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    background: var(--white);
    padding: 0 6px;
    text-align: right;
}

.sales-opportunities-plan-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =========================
   REVENUE MATRIX
========================= */

.revenue-year-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    flex-wrap: wrap;
    margin: 22px 0 14px;
}

.revenue-year-section-header h3 {
    margin: 0 0 4px;
}

.revenue-year-section-header p {
    margin: 0;
    color: var(--text-muted);
}

.revenue-matrix-filters {
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.revenue-matrix-filters label {
    display: grid;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.revenue-matrix-filters input,
.revenue-matrix-filters select {
    min-width: 190px;
}

.revenue-matrix-filters input[name="year"] {
    min-width: 120px;
}

.revenue-matrix-wrap {
    width: 100%;
    overflow-x: auto;
}

.revenue-matrix-table {
    width: 100%;
    min-width: 1220px;
    border-collapse: collapse;
    table-layout: fixed;
}

.revenue-matrix-table th,
.revenue-matrix-table td {
    border: 1px solid #d7d7d7;
    padding: 8px 9px;
    vertical-align: middle;
    font-size: 0.7rem;
    background: #ffffff;
}

.revenue-matrix-table th {
    background: #f5f5f5;
    color: var(--black);
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.revenue-matrix-table td {
    white-space: nowrap;
}

.revenue-matrix-table td strong {
    font-weight: 700;
}

.revenue-matrix-table td span {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.6rem;
    white-space: normal;
}

.revenue-matrix-table th:nth-child(1),
.revenue-matrix-table td:nth-child(1) {
    width: 140px;
}

.revenue-matrix-table th:nth-child(2),
.revenue-matrix-table td:nth-child(2) {
    width: 90px;
    text-align: center;
}

.revenue-matrix-table th:nth-child(n+3),
.revenue-matrix-table td:nth-child(n+3) {
    width: 78px;
    text-align: center !important;
}

.revenue-matrix-table th:last-child,
.revenue-matrix-table td:last-child {
    width: 90px;
    border-left: 1px solid #d7d7d7 !important;
    text-align: center !important;
}

.revenue-department-cell {
    background: #ffffff !important;
    vertical-align: middle !important;
    border-right: 1px solid #d7d7d7 !important;
    white-space: normal !important;
}

.revenue-department-cell strong {
    display: block;
    font-size: 0.75rem;
}

.revenue-row-type {
    text-align: center;
    font-weight: 700;
}

.revenue-plan-label-cell,
.revenue-plan-month-cell,
.revenue-plan-total-cell {
    background: #eeeeef !important;
	color: #adadad !important;
}

.revenue-plan-total-cell strong {
    background: #eeeeef !important;
	color: #adadad !important;
}

.revenue-total-cell {
    border-left: 1px solid #d7d7d7 !important;
}

.revenue-cell-neutral {
    background: #ffffff !important;
}

.revenue-cell-future {
    background: #ffffff !important;
}

.revenue-cell-red {
    background: #f8d7da !important;
    color: #842029 !important;
    font-weight: 500;
}

.revenue-cell-yellow {
    background: #fff3cd !important;
    color: #664d03 !important;
    font-weight: 500;
}

.revenue-cell-light-green {
    background: #d1e7dd !important;
    color: #0f5132 !important;
    font-weight: 500;
}

.revenue-cell-dark-green {
    background: #198754 !important;
    color: #ffffff !important;
    font-weight: 500;
}

/* =========================
   REVENUE PLAN EDIT
========================= */

.revenue-plan-edit-wrap {
    width: 100%;
    overflow-x: auto;
}

.revenue-plan-edit-table {
    min-width: 1220px;
    table-layout: fixed;
    border-collapse: collapse;
}

.revenue-plan-edit-table th,
.revenue-plan-edit-table td {
    border: 1px solid #d7d7d7;
    padding: 8px 9px;
    vertical-align: middle;
}

.revenue-plan-edit-table th {
    background: #f5f5f5;
    color: var(--black);
    text-align: center;
    white-space: nowrap;
}

.revenue-plan-edit-table th:nth-child(1),
.revenue-plan-edit-table td:nth-child(1) {
    width: 260px;
}

.revenue-plan-edit-table th:nth-child(n+2),
.revenue-plan-edit-table td:nth-child(n+2) {
    width: 86px;
}

.revenue-plan-edit-table input[type="text"] {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    background: var(--white);
    padding: 0 6px;
    text-align: right;
    white-space: nowrap;
}

.revenue-plan-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.revenue-plan-row,
.revenue-realization-row{
	height: 60px;
}

/* =========================
   DASHBOARDY / ZARZĄD
========================= */

.dashboard-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.dashboard-subnav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--white);
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
}

.dashboard-subnav-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.dashboard-management-filters {
    align-items: flex-end;
    flex-wrap: wrap;
}

.dashboard-management-filters label {
    display: grid;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dashboard-management-filters input[name="year"] {
    min-width: 120px;
}

/* Tylko minimalna korekta dla bardzo długiej nazwy w pierwszej kolumnie.
   Reszta tabeli idzie z .revenue-matrix-table. */
.dashboard-management-table .revenue-department-cell strong {
    line-height: 1.2;
}

/* =========================
   DASHBOARDY / EDYCJA PLANÓW
========================= */

.dashboard-plan-edit-wrap {
    width: 100%;
    overflow-x: auto;
}

.dashboard-plan-edit-table {
    min-width: 1220px;
    table-layout: fixed;
    border-collapse: collapse;
}

.dashboard-plan-edit-table th,
.dashboard-plan-edit-table td {
    border: 1px solid #d7d7d7;
    padding: 8px 9px;
    vertical-align: middle;
    font-size: 0.7rem;
}

.dashboard-plan-edit-table th {
    background: #f5f5f5;
    color: var(--black);
    text-align: center;
    white-space: nowrap;
}

.dashboard-plan-edit-table th:nth-child(1),
.dashboard-plan-edit-table td:nth-child(1) {
    width: 260px;
}

.dashboard-plan-edit-table th:nth-child(n+2),
.dashboard-plan-edit-table td:nth-child(n+2) {
    width: 86px;
}

.dashboard-plan-edit-table td span {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.6rem;
    white-space: normal;
}

.dashboard-plan-edit-table input[type="text"] {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    background: var(--white);
    padding: 0 6px;
    text-align: right;
    white-space: nowrap;
}

.dashboard-plan-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 768px) {
    .dashboard-management-filters {
        width: 100%;
        justify-content: flex-start;
    }

    .dashboard-management-filters label,
    .dashboard-management-filters input[name="year"],
    .dashboard-management-filters button {
        width: 100%;
    }

    .dashboard-subnav-link {
        width: 100%;
    }
}

/* =========================================================
   DASHBOARDY / ZARZĄD — final override tabeli
========================================================= */

.dashboard-management-wrap {
    width: 100%;
    overflow-x: auto;
}

.dashboard-management-table {
    width: 100% !important;
    min-width: 1220px !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
}

.dashboard-management-table th,
.dashboard-management-table td {
    border: 1px solid #d7d7d7 !important;
    padding: 8px 9px !important;
    vertical-align: middle !important;
    font-size: 0.7rem !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
}

.dashboard-management-table th {
    background: #f5f5f5 !important;
    color: var(--black) !important;
    font-weight: 700 !important;
    text-align: center !important;
    white-space: nowrap !important;
}

.dashboard-management-table th:nth-child(1),
.dashboard-management-table td:nth-child(1) {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
}

.dashboard-management-table th:nth-child(2),
.dashboard-management-table td:nth-child(2) {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
    text-align: center !important;
}

.dashboard-management-table th:nth-child(n+3),
.dashboard-management-table td:nth-child(n+3) {
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    text-align: center !important;
    white-space: nowrap !important;
}

.dashboard-management-table th:last-child,
.dashboard-management-table td:last-child {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
    text-align: center !important;
    border-left: 1px solid #d7d7d7 !important;
}

.dashboard-management-table .revenue-plan-row,
.dashboard-management-table .revenue-realization-row {
    height: 60px !important;
}

.dashboard-management-table .revenue-plan-row td,
.dashboard-management-table .revenue-plan-label-cell,
.dashboard-management-table .revenue-plan-month-cell,
.dashboard-management-table .revenue-plan-total-cell {
    background: #eeeeef !important;
	color: #adadad !important;
}

.dashboard-management-table .revenue-department-cell {
    background: #ffffff !important;
    vertical-align: middle !important;
    white-space: normal !important;
    border-right: 1px solid #d7d7d7 !important;
}

.dashboard-management-table .revenue-department-cell strong {
    display: block !important;
    font-size: 0.75rem !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
}

.dashboard-management-table .revenue-department-cell span {
    display: block !important;
    margin-top: 3px !important;
    color: var(--text-muted) !important;
    font-size: 0.6rem !important;
    line-height: 1.2 !important;
    white-space: normal !important;
}

.dashboard-management-table .revenue-row-type {
    text-align: center !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
}

.dashboard-management-table .revenue-total-cell {
    border-left: 1px solid #d7d7d7 !important;
    font-weight: 700 !important;
}

.dashboard-management-table .dashboard-money-cell,
.dashboard-management-table .dashboard-money-cell strong {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
}

/* kolory realizacji wymuszone także CSS-em */
.dashboard-management-table .revenue-cell-neutral {
    background: #ffffff !important;
}

.dashboard-management-table .revenue-cell-future {
    background: #ffffff !important;
}

.dashboard-management-table .revenue-cell-red {
    background: #f8d7da !important;
    color: #842029 !important;
    font-weight: 500 !important;
}

.dashboard-management-table .revenue-cell-yellow {
    background: #fff3cd !important;
    color: #664d03 !important;
    font-weight: 500 !important;
}

.dashboard-management-table .revenue-cell-light-green {
    background: #d1e7dd !important;
    color: #0f5132 !important;
    font-weight: 500 !important;
}

.dashboard-management-table .revenue-cell-dark-green {
    background: #198754 !important;
    color: #ffffff !important;
    font-weight: 500 !important;
}

/* Dashboard Zarządu - białe tło pierwszej kolumny */
.dashboard-management-table tr td.revenue-department-cell,
.dashboard-management-table tbody tr:hover td.revenue-department-cell {
    background: #ffffff !important;
}

.dashboard-management-table tr td.revenue-department-cell strong,
.dashboard-management-table tr td.revenue-department-cell span {
    background: transparent !important;
}

/* Koszty — zawijanie długich nazw działów i typów kosztów */
.revenue-matrix-table td,
.revenue-matrix-table th {
    white-space: normal;
}

.revenue-matrix-table td:nth-child(2),
.revenue-matrix-table td:nth-child(3),
.revenue-matrix-table th:nth-child(2),
.revenue-matrix-table th:nth-child(3) {
    min-width: 160px;
    max-width: 240px;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

/* Żeby miesiące nadal były zwarte */
.revenue-matrix-table td.text-center,
.revenue-matrix-table th.text-center {
    white-space: nowrap;
    min-width: 82px;
}

/* Pierwsza kolumna — komórka organizacyjna */
.revenue-matrix-table td:first-child,
.revenue-matrix-table th:first-child {
    min-width: 180px;
    max-width: 240px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.cost-category-original-name {
    display: block;
    margin-top: 3px;
    color: #8a94a6;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.3;
}

.dashboard-row-name-with-info {
    display: inline !important;
    position: relative;
    white-space: normal;
}

.dashboard-row-name-with-info strong {
    display: inline !important;
}

.dashboard-info-icon {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    min-width: 15px;
    margin: 0 0 0 4px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #cfd4dc;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    font-family: Arial, sans-serif;
    cursor: help;
    vertical-align: text-top;
    box-shadow: none;
}

.dashboard-info-icon:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #374151;
}

.dashboard-info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    width: 320px;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
    color: #344054;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.dashboard-info-icon::before {
    content: "";
    position: absolute;
    left: calc(100% + 5px);
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-left: 1px solid #d0d5dd;
    border-bottom: 1px solid #d0d5dd;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 10000;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.dashboard-info-icon:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.dashboard-info-icon:hover::before {
    opacity: 1;
    visibility: visible;
}

.revenue-department-cell .dashboard-row-name-with-info,
.revenue-department-cell .dashboard-row-name-with-info strong {
    display: inline !important;
}

.revenue-department-cell .dashboard-row-name-with-info .dashboard-info-icon {
    display: inline-flex !important;
    margin-left: 4px;
    vertical-align: text-top;
}

/* Dashboard Zarząd - tabele bez wewnętrznego pionowego scrolla */
.dashboard-management-wrap {
    max-height: none !important;
    height: auto !important;
    overflow-y: visible !important;
}

/* Zostawiamy ewentualny poziomy scroll, jeśli tabela jest szersza niż ekran */
.dashboard-management-wrap.table-wrap,
.table-wrap.dashboard-management-wrap {
    overflow-x: auto !important;
    overflow-y: visible !important;
}

.dashboard-info-icon::before,
.dashboard-info-icon::after {
    display: none !important;
    content: none !important;
}

.dashboard-floating-tooltip {
    position: fixed;
    z-index: 2147483647;
    width: min(420px, calc(100vw - 24px));
    max-width: 420px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.20);
    color: #344054;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
}

.dashboard-floating-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dashboard-floating-tooltip::after {
    content: "";
    position: absolute;
    left: var(--arrow-left, 50%);
    bottom: -6px;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-right: 1px solid #d0d5dd;
    border-bottom: 1px solid #d0d5dd;
    transform: translateX(-50%) rotate(45deg);
}

.dashboard-section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 20px;
}

.dashboard-section-tabs .dashboard-subnav-link {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .dashboard-section-tabs {
        flex-direction: column;
    }

    .dashboard-section-tabs .dashboard-subnav-link {
        width: 100%;
        justify-content: center;
    }
}

.sidebar-group {
    display: block;
}

.sidebar-group summary {
    list-style: none;
    cursor: pointer;
}

.sidebar-group summary::-webkit-details-marker {
    display: none;
}

.sidebar-group-summary {
    width: 100%;
}

.sidebar-group-chevron {
    margin-left: auto;
    font-size: 0.72rem;
    color: #A3A3A3;
    transition: transform 0.15s ease;
}

.sidebar-subnav {
    display: grid;
    gap: 2px;
    margin: 4px 0 8px 39px;
    padding-left: 10px;
    border-left: 1px solid #2f2f2f;
}

.sidebar-subnav-title {
    padding: 8px 8px 4px;
    color: #A3A3A3;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    color: #D4D4D4;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 0;
    border-left: 3px solid transparent;
}

.sidebar-sublink:hover {
    background: var(--dark);
    color: var(--white);
}

.sidebar-sublink.active {
    background: var(--dark);
    color: var(--white);
    border-left-color: var(--primary);
}

.sidebar-nested-group {
    display: block;
}

.sidebar-nested-group summary {
    list-style: none;
    cursor: pointer;
}

.sidebar-nested-group summary::-webkit-details-marker {
    display: none;
}

.sidebar-nested-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-nested-subnav {
    display: grid;
    gap: 2px;
    margin-top: 4px;
}

.sidebar-main-chevron,
.sidebar-nested-chevron {
    transition: transform 0.15s ease;
}

.sidebar-group[open] > .sidebar-group-summary .sidebar-main-chevron {
    transform: rotate(180deg);
}

.sidebar-nested-group[open] > .sidebar-nested-summary .sidebar-nested-chevron {
    transform: rotate(180deg);
}

.sidebar-nested-group:not([open]) > .sidebar-nested-summary .sidebar-nested-chevron {
    transform: rotate(0deg);
}

/* vAnalytics brand mark */
.sidebar-logo {
    display: block;
    width: 72px;
    height: 48px;
    flex: 0 0 72px;
    object-fit: contain;
    background: transparent;
}

/* vAnalytics transparent logo override */
.sidebar-logo {
    display: block;
    width: 72px;
    height: 48px;
    flex: 0 0 72px;
    object-fit: contain;
    padding: 0;
    background: transparent !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* VANALYTICS_NEW_INITIATIVES_UI_V2:start */

.new-initiatives-report {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.new-initiatives-report .page-header-row {
    margin-bottom: 0;
}

.new-initiatives-report .dashboard-management-filters {
    align-self: flex-end;
}

.new-initiatives-card {
    background: #fff;
    border: 1px solid #e3e6ea;
}

.new-initiatives-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #e3e6ea;
}

.new-initiatives-card-header h3 {
    margin: 0 0 4px;
    font-size: 18px;
    line-height: 1.25;
}

.new-initiatives-card-header p {
    margin: 0;
    color: #667085;
    font-size: 13px;
    line-height: 1.45;
}

.new-initiatives-card .table-wrap {
    margin: 0;
}

.new-initiatives-card .revenue-matrix-table {
    margin: 0;
}

.new-initiatives-detail-table th:first-child,
.new-initiatives-detail-table td:first-child {
    min-width: 240px;
    width: 240px;
}

.new-initiatives-detail-table th:not(:first-child),
.new-initiatives-detail-table td:not(:first-child) {
    min-width: 88px;
}

.new-initiatives-name-cell strong {
    display: block;
    line-height: 1.3;
}

.new-initiatives-tax-no {
    display: block;
    margin-top: 4px;
    color: #7a828d;
    font-size: 11px;
    font-weight: 400;
}

.new-initiatives-empty {
    padding: 24px !important;
    text-align: center;
    color: #7a828d;
}

/* VANALYTICS_NEW_INITIATIVES_UI_V2:end */
