/* ============================================================
   Gluten Holding 2.0 — Linear/Notion-Inspired Design System
   ============================================================ */

/* --- CSS Variables (Light theme default) ---
   2026-05-26 iteracja: zwiekszony kontrast (tlo strony lekko szare, karty biale,
   borders wyrazne) zeby tabele/karty/przyciski nie zlewaly sie ze soba */
:root {
    /* Backgrounds - tlo strony LEKKO SZARE (jak iOS/Notion), karty BIALE */
    --bg: #f5f5f7;
    --bg-secondary: #ececee;
    --bg-tertiary: #e0e0e3;
    --bg-elevated: #ffffff;
    --bg-active: #d8d8db;

    /* Sidebar - BIALY w light theme (2026-05-26 iteracja) */
    --sidebar-bg: #ffffff;
    --sidebar-border: #e0e0e3;
    --sidebar-hover: #f0f0f3;
    --sidebar-active-bg: rgba(240, 165, 0, 0.12);
    --sidebar-active-border: var(--accent);
    --sidebar-text: #2a2a2e;
    --sidebar-text-muted: #6b6f76;
    --sidebar-section-text: #8c8f96;
    --sidebar-active-text: #1a1a1a;
    --sidebar-submenu-bg: rgba(0, 0, 0, 0.04);
    --sidebar-badge-bg: #d8d8db;
    --sidebar-badge-text: #5a5e66;

    /* Text */
    --text-primary: #1a1a1a;
    --text-secondary: #5a5e66;
    --text-muted: #7a7e86;

    /* Borders - wyrazne separatory miedzy elementami */
    --border: #d0d0d4;
    --border-light: #e0e0e3;

    /* Accent (orange - Gluten brand) */
    --accent: #f0a500;
    --accent-hover: #d4900a;
    --accent-subtle: rgba(240, 165, 0, 0.1);
    --btn-accent-text: #000;

    /* Cards / inputs - biale karty na szarym tle = naturalny kontrast */
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --input-border: #c8c8cc;

    /* Topbar */
    --topbar-bg: #ffffff;
    --topbar-border: #d0d0d4;

    /* Shadows - mocniejsze zeby karty mialy wyrazne podniesienie nad tlem */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
    --shadow-modal: 0 20px 50px rgba(0, 0, 0, 0.2), 0 10px 20px rgba(0, 0, 0, 0.12);

    /* Overlay */
    --overlay-bg: rgba(0, 0, 0, 0.25);

    /* Semantic colors */
    --green: #28a745;
    --red: #dc3545;
    --blue: #0d6efd;
    --orange: #fd7e14;
    --purple: #6f42c1;

    /* Mono */
    --mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

    /* Aliasy backward compat (86 templates ich uzywa) */
    --bg-raised: var(--card-bg);
    --bg-hover: var(--bg-tertiary);
    --bg-sidebar: var(--sidebar-bg);
    --text: var(--text-primary);
    --text-2: var(--text-secondary);
    --text-3: var(--text-muted);
    --border-subtle: var(--border-light);
    --accent-soft: var(--accent-subtle);

    /* Bootstrap overrides (bound to design tokens) */
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text-primary);
    --bs-heading-color: var(--text-primary);
    --bs-link-color: var(--accent);
    --bs-border-color: var(--border);
    --bs-table-color: var(--text-primary);
    --bs-table-bg: var(--card-bg);
    --bs-table-striped-bg: var(--bg-tertiary);
    --bs-table-hover-bg: var(--bg-active);
    --bs-modal-bg: var(--card-bg);
    --bs-dropdown-bg: var(--card-bg);
    --bs-secondary-bg: var(--bg-tertiary);
}

/* Dark theme */
[data-theme="dark"],
body.dark-mode {
    --bg: #111113;
    --bg-secondary: #19191c;
    --bg-tertiary: #1e1e22;
    --bg-elevated: #19191c;
    --bg-active: #252529;

    /* Sidebar - ciemny w dark mode (oryginalne wartosci sprzed 2026-05-26) */
    --sidebar-bg: #161618;
    --sidebar-border: #2a2a2e;
    --sidebar-hover: #1e1e22;
    --sidebar-active-bg: #252529;
    --sidebar-active-border: var(--accent);
    --sidebar-text: #ececee;
    --sidebar-text-muted: #8b8b92;
    --sidebar-section-text: #5a5a5e;
    --sidebar-active-text: #f5f5f5;
    --sidebar-submenu-bg: rgba(0, 0, 0, 0.15);
    --sidebar-badge-bg: #252529;
    --sidebar-badge-text: #8e8e93;

    --text-primary: #ececee;
    --text-secondary: #8b8b92;
    --text-muted: #5c5c64;

    --border: #2a2a2e;
    --border-light: #222226;

    --accent: #f0a500;
    --accent-hover: #ffc233;
    --accent-subtle: rgba(240, 165, 0, 0.1);
    --btn-accent-text: #000;

    --card-bg: #19191c;
    --input-bg: #19191c;
    --input-border: #2a2a2e;

    --topbar-bg: #161618;
    --topbar-border: #2a2a2e;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.6);

    --overlay-bg: rgba(0, 0, 0, 0.55);

    --green: #30d158;
    --red: #ff453a;
    --blue: #0a84ff;
    --orange: #ff9f0a;
    --purple: #bf5af2;

    /* aliasy backward compat dziedzicza var() z :root automatycznie */
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}
h1 { font-weight: 700; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent); opacity: 0.85; }

p { color: inherit; }
strong, b { color: var(--text); }
small:not(.text-muted) { color: var(--text-2); }
label, .form-label, .col-form-label { color: var(--text); }

/* Monospace accents for data */
.mono, .font-mono {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-2);
}

/* --- LAYOUT --- */
#appLayout {
    height: 100vh;
    height: 100dvh;
}
body.has-dev-banner #appLayout {
    height: calc(100vh - 52px);
    height: calc(100dvh - 52px);
}

/* ============================================================
   SIDEBAR — Always dark, Linear-style navigation
   ============================================================ */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg-sidebar);
    color: #8e8e93;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.25s ease, min-width 0.25s ease, margin-left 0.3s ease;
    z-index: 1000;
    border-right: 1px solid #222225;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}
.sidebar.collapsed *:not(.sidebar-collapse-btn):not(.sidebar-collapse-btn *) {
    display: none !important;
}
.sidebar.collapsed .sidebar-slogan {
    display: none !important;
}

/* Expand button (visible when collapsed) */
.sidebar-expand-btn {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 48px;
    background: rgba(25, 25, 28, 0.95);
    border: 1px solid #2a2a2e;
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: #5a5a5e;
    cursor: pointer;
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: color 0.15s, background 0.15s;
    padding: 0;
}
.sidebar-expand-btn:hover {
    color: var(--accent);
    background: #19191c;
}

/* Collapse button */
.sidebar-collapse-btn {
    background: none;
    border: none;
    color: #5a5a5e;
    cursor: pointer;
    padding: 2px;
    margin-left: auto;
    font-size: 0.85rem;
    line-height: 1;
    transition: color 0.15s;
}
.sidebar-collapse-btn:hover {
    color: var(--accent);
}
.sidebar.collapsed .sidebar-collapse-btn {
    display: flex !important;
    margin: 4px auto 0;
    color: #5a5a5e;
    font-size: 1.1rem;
}
.sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

/* Sidebar header */
.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--sidebar-text);
    letter-spacing: -0.02em;
}
.sidebar-brand i {
    font-size: 1.2rem;
    color: var(--accent);
}
.sidebar-brand .brand-text {
    font-size: 0.88rem;
    font-weight: 700;
}

.sidebar-version {
    font-size: 0.65rem;
    color: var(--accent);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 4px;
    padding-left: 32px;
    font-weight: 500;
}
.sidebar-slogan {
    font-size: 0.7rem;
    color: #5a5a5e;
    margin-top: 2px;
    padding-left: 32px;
}

/* Sidebar menu */
.sidebar-menu {
    list-style: none;
    padding: 4px 8px;
    margin: 0;
    overflow-y: auto;
}
.sidebar-item {
    list-style: none;
}

.sidebar-section {
    padding: 16px 12px 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sidebar-section-text);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    margin: 1px 0;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 450;
    border-radius: 6px;
    border-left: 3px solid transparent;
    transition: all 0.1s ease;
}
.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    text-decoration: none;
    opacity: 1;
}
.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 500;
    border-left-color: var(--sidebar-active-border);
}
.sidebar-link.active i:first-child {
    color: var(--accent);
    opacity: 1;
}
.sidebar-link i:first-child {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    opacity: 0.6;
}
.sidebar-link .badge,
.sidebar-link .count {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--sidebar-badge-bg);
    padding: 1px 6px;
    border-radius: 10px;
    color: var(--sidebar-badge-text);
}

/* Disabled modules (WIP) */
.sidebar-link.disabled-module {
    opacity: 0.35;
    cursor: not-allowed;
}
.sidebar-link.disabled-module:hover {
    background: none;
    color: var(--sidebar-text-muted);
}
.badge-wip {
    font-size: 0.6rem;
    padding: 2px 6px;
    letter-spacing: 0.5px;
}

/* Submenu */
.sidebar-submenu {
    list-style: none;
    padding: 0 0 0 8px;
    margin: 0;
    background: var(--sidebar-submenu-bg);
    border-radius: 0 0 6px 6px;
}
.sidebar-sublink {
    display: block;
    padding: 5px 12px 5px 40px;
    color: var(--sidebar-text);
    opacity: 0.85;
    text-decoration: none;
    font-size: 0.82rem;
    border-radius: 6px;
    transition: all 0.1s;
}
.sidebar-sublink:hover {
    color: var(--sidebar-text);
    background: var(--sidebar-hover);
    text-decoration: none;
}
.sidebar-sublink.active {
    color: var(--accent);
    font-weight: 500;
}

.submenu-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}
.sidebar-link[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

/* Sidebar footer */
.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid var(--sidebar-border);
    font-size: 0.82rem;
}

/* User pill (sidebar footer) */
.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
}
.user-pill:hover { background: var(--sidebar-hover); }
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sidebar-text-muted), var(--sidebar-text));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--sidebar-bg);
}
.user-pill .user-name { font-size: 0.82rem; font-weight: 500; color: var(--sidebar-text); }
.user-pill .user-role { font-size: 0.65rem; color: var(--sidebar-section-text); }

/* ============================================================
   TOPBAR — Minimal, 52px height
   ============================================================ */
.topbar {
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-subtle);
    min-height: 52px;
    gap: 12px;
}
.topbar-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Theme toggle */
.theme-toggle,
.icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.1s;
}
.theme-toggle:hover,
.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
}
.page-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* ============================================================
   CARDS — Minimal with subtle borders
   ============================================================ */
.card {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text);
    box-shadow: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover {
    border-color: var(--border);
}
.card-header {
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 14px 20px;
    color: var(--text);
}
.card-body {
    padding: 20px;
    color: var(--text);
}
.card-title { color: var(--text); }
.card-text { color: var(--text-2); }
.card-footer {
    background: var(--bg);
    border-top: 1px solid var(--border-subtle);
    color: var(--text-2);
    padding: 12px 20px;
}

/* Spolka cards (dashboard) */
.spolka-card {
    transition: all 0.15s ease;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--bg-raised);
    cursor: pointer;
}
.spolka-card:hover {
    border-color: var(--border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}
.spolka-card .card-body * { color: var(--text); }
.spolka-card .card-body h5,
.spolka-card .card-body h4,
.spolka-card .card-body .h5 { color: var(--text); font-weight: 600; }

/* Stat cards */
.stat-card {
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--bg-raised);
    box-shadow: none;
    transition: all 0.15s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border);
}
.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* Connected stat blocks (Linear-style) */
.stats-row {
    display: flex;
    gap: 1px;
    background: var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}
.stat-block {
    flex: 1;
    padding: 20px 24px;
    background: var(--bg-raised);
    transition: background 0.15s;
    cursor: default;
}
.stat-block:hover { background: var(--bg-hover); }
.stat-block .label {
    font-size: 0.72rem;
    color: var(--text-3);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.stat-block .value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
}
.stat-block .delta { font-size: 0.72rem; font-weight: 500; margin-top: 4px; }
.stat-block .delta.up { color: var(--green); }
.stat-block .delta.down { color: var(--red); }

/* Stats bar (legacy) */
.stats-bar .badge { font-weight: 500; }
#lokaleContent { min-height: 400px; }

/* Project cards (Linear-style) */
.projects-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.projects-header h2 { font-size: 0.95rem; font-weight: 600; }
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}
.project-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.15s;
}
.project-card:hover {
    border-color: var(--border);
    background: var(--bg-hover);
}
.project-card .indicator {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-bottom: 14px;
}
.project-card h3 { font-size: 0.92rem; font-weight: 600; margin-bottom: 6px; }
.project-card p { font-size: 0.78rem; color: var(--text-2); line-height: 1.5; margin-bottom: 16px; }
.project-card .meta { display: flex; align-items: center; gap: 12px; }
.project-card .meta-item { font-size: 0.7rem; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.project-card .progress-bar {
    height: 3px;
    background: var(--bg-active);
    border-radius: 2px;
    margin-top: 14px;
    overflow: hidden;
}
.project-card .progress-bar .fill { height: 100%; border-radius: 2px; }

/* ============================================================
   TABLES — Clean, minimal borders
   ============================================================ */
.table {
    color: var(--text);
    --bs-table-bg: var(--bg-raised);
    --bs-table-striped-bg: var(--bg-hover);
    --bs-table-hover-bg: var(--bg-active);
    border-color: var(--border-subtle);
    font-size: 0.84rem;
}
.table > :not(caption) > * > * {
    color: var(--text);
    border-bottom-color: var(--border-subtle);
    padding: 10px 16px;
}
.table > thead > tr > th {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-raised);
}

.table-light,
thead.table-light,
thead.table-light th {
    --bs-table-bg: var(--bg-raised) !important;
    --bs-table-color: var(--text-2) !important;
    background-color: var(--bg-raised) !important;
    color: var(--text-2) !important;
    border-color: var(--border-subtle) !important;
}

.data-table { font-size: 0.84rem; }
.data-table th {
    white-space: nowrap;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data-table td { vertical-align: middle; }

/* Table section wrapper (Linear-style) */
.table-section {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
}
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
}
.table-header h2 { font-size: 0.88rem; font-weight: 600; }

/* Min table (Linear-style inline table) */
.min-table { width: 100%; border-collapse: collapse; }
.min-table th {
    padding: 10px 20px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}
.min-table td {
    padding: 12px 20px;
    font-size: 0.84rem;
    border-bottom: 1px solid var(--border-subtle);
}
.min-table tr:hover td { background: var(--bg-hover); }
.min-table .mono {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-2);
}

/* Responsive tables */
.page-content .table-responsive,
.page-content .card-body > .table,
.page-content > table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
/* Visible horizontal scrollbar for wide tables */
.table-responsive::-webkit-scrollbar { height: 10px; }
.table-responsive::-webkit-scrollbar-track { background: var(--bg-active, #252529); border-radius: 5px; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--text-3, #5a5a5e); border-radius: 5px; min-width: 40px; }
.table-responsive::-webkit-scrollbar-thumb:hover { background: var(--text-2, #8e8e93); }
.table-responsive { scrollbar-width: auto; scrollbar-color: var(--text-3, #5a5a5e) var(--bg-active, #252529); }

/* Colored table rows */
.row-green { background-color: rgba(48, 209, 88, 0.08) !important; }
.row-red { background-color: rgba(255, 69, 58, 0.08) !important; }
.row-yellow { background-color: rgba(255, 159, 10, 0.1) !important; }
.row-orange { background-color: rgba(255, 159, 10, 0.12) !important; }
.row-purple { background-color: rgba(191, 90, 242, 0.08) !important; }
.row-blue { background-color: rgba(10, 132, 255, 0.08) !important; }

.row-green:hover { background-color: rgba(48, 209, 88, 0.14) !important; }
.row-red:hover { background-color: rgba(255, 69, 58, 0.14) !important; }
.row-yellow:hover { background-color: rgba(255, 159, 10, 0.16) !important; }
.row-orange:hover { background-color: rgba(255, 159, 10, 0.18) !important; }
.row-purple:hover { background-color: rgba(191, 90, 242, 0.14) !important; }
.row-blue:hover { background-color: rgba(10, 132, 255, 0.14) !important; }

/* Negative amounts */
.kwota-ujemna {
    color: var(--red);
    font-weight: 600;
    font-family: var(--mono);
}

/* Legend items */
.legend-item {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
}
.legend-green { background-color: rgba(48, 209, 88, 0.12); color: var(--green); }
.legend-red { background-color: rgba(255, 69, 58, 0.12); color: var(--red); }
.legend-yellow { background-color: rgba(255, 159, 10, 0.12); color: var(--orange); }
.legend-orange { background-color: rgba(255, 159, 10, 0.15); color: var(--orange); }
.legend-purple { background-color: rgba(191, 90, 242, 0.12); color: var(--purple); }
.legend-blue { background-color: rgba(10, 132, 255, 0.12); color: var(--blue); }

/* ============================================================
   FORMS — Minimal inputs
   ============================================================ */
.form-control,
.form-select {
    background-color: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.875rem;
    padding: 8px 12px;
    transition: border-color 0.15s ease;
    font-family: inherit;
}
.form-control:focus,
.form-select:focus {
    background-color: var(--bg-raised);
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-control::placeholder,
.form-select::placeholder {
    color: var(--text-3);
}

.input-group-text {
    background-color: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 0.84rem;
}

.form-check-label { color: var(--text); }

/* ============================================================
   TABS — Clean underline style
   ============================================================ */
.nav-tabs {
    border-bottom: 1px solid var(--border-subtle);
}
.nav-tabs .nav-link {
    font-weight: 500;
    font-size: 0.84rem;
    color: var(--text-2);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 16px;
    border-radius: 0;
    transition: all 0.15s;
}
.nav-tabs .nav-link:hover {
    color: var(--text);
    border-bottom-color: var(--border);
    background: transparent;
}
.nav-tabs .nav-link.active {
    font-weight: 600;
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    background: transparent;
    border-color: transparent transparent var(--accent);
}

.nav-pills .nav-link {
    color: var(--text-2);
    border-radius: 6px;
    font-size: 0.84rem;
    padding: 6px 14px;
    transition: all 0.1s;
}
.nav-pills .nav-link:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.nav-pills .nav-link.active {
    background: var(--accent);
    color: #000;
}

.tab-content { color: var(--text); }

/* ============================================================
   ALERTS — Subtle, pill-style
   ============================================================ */
.alert {
    border-radius: 8px;
    font-size: 0.84rem;
    border: 1px solid;
    padding: 12px 16px;
}
.alert-info {
    background: rgba(10, 132, 255, 0.08);
    border-color: rgba(10, 132, 255, 0.15);
    color: var(--blue);
}
.alert-success {
    background: rgba(48, 209, 88, 0.08);
    border-color: rgba(48, 209, 88, 0.15);
    color: var(--green);
}
.alert-warning {
    background: rgba(255, 159, 10, 0.08);
    border-color: rgba(255, 159, 10, 0.15);
    color: var(--orange);
}
.alert-danger {
    background: rgba(255, 69, 58, 0.08);
    border-color: rgba(255, 69, 58, 0.15);
    color: var(--red);
}
.alert-secondary {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-2);
}

/* ============================================================
   MODALS — Clean overlay
   ============================================================ */
.modal-content {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    box-shadow: var(--shadow-modal);
}
.modal-header {
    border-bottom: 1px solid var(--border-subtle);
    padding: 16px 20px;
}
.modal-header .modal-title { font-size: 0.95rem; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 12px 20px;
}
.btn-close {
    filter: none;
    opacity: 0.5;
}
[data-theme="dark"] .btn-close,
body.dark-mode .btn-close {
    filter: invert(1);
}

/* ============================================================
   DROPDOWNS — Floating menu style
   ============================================================ */
.dropdown-menu {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    padding: 4px;
    min-width: 180px;
}
.dropdown-item {
    color: var(--text);
    font-size: 0.84rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.1s;
}
.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--bg-hover);
    color: var(--text);
}
.dropdown-divider { border-top-color: var(--border-subtle); }

/* ============================================================
   BADGES & PILLS
   ============================================================ */
.badge {
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    border-radius: 6px;
    padding: 3px 8px;
}
.badge-sm {
    font-size: 0.65rem;
    padding: 2px 6px;
}
.badge.bg-warning { color: #000 !important; }
.badge.bg-light {
    background-color: var(--bg-active) !important;
    color: var(--text-2) !important;
}

/* Status pills (Linear-style) */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
}
.pill.green { background: rgba(48, 209, 88, 0.1); color: var(--green); }
.pill.orange { background: rgba(255, 159, 10, 0.1); color: var(--orange); }
.pill.red { background: rgba(255, 69, 58, 0.1); color: var(--red); }
.pill.blue { background: rgba(10, 132, 255, 0.1); color: var(--blue); }
.pill.purple { background: rgba(191, 90, 242, 0.1); color: var(--purple); }

/* Filter pills */
.table-filter { display: flex; gap: 4px; }
.filter-pill {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.1s;
}
.filter-pill:hover { background: var(--bg-hover); color: var(--text); }
.filter-pill.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: rgba(240, 165, 0, 0.3);
}

/* ============================================================
   BUTTONS — Minimal, clean
   ============================================================ */
.btn {
    font-size: 0.84rem;
    font-weight: 500;
    border-radius: 8px;
    padding: 6px 14px;
    transition: all 0.15s ease;
    font-family: inherit;
}
.btn-outline-secondary {
    color: var(--text-2);
    border-color: var(--border);
}
.btn-outline-secondary:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border);
}
.btn-outline-primary {
    color: var(--blue);
    border-color: var(--blue);
}
.btn-outline-primary:hover {
    background: rgba(10, 132, 255, 0.1);
    color: var(--blue);
    border-color: var(--blue);
}
.btn-outline-danger {
    color: var(--red);
    border-color: var(--red);
}
.btn-outline-danger:hover {
    background: rgba(255, 69, 58, 0.1);
    color: var(--red);
    border-color: var(--red);
}

/* Action buttons in tables */
.btn-manual-match, .btn-hide-trans, .btn-delete-match, .btn-accept-suggestion {
    padding: 2px 8px;
    font-size: 0.72rem;
    border-radius: 6px;
}
.sugestia-badge { font-size: 0.75rem; }

/* ============================================================
   LIST GROUPS
   ============================================================ */
.list-group-item {
    background-color: var(--bg-raised);
    border-color: var(--border-subtle);
    color: var(--text);
    transition: background 0.1s;
}
.list-group-item-action:hover,
.list-group-item-action:focus {
    background-color: var(--bg-hover);
    color: var(--text);
}
.list-group-item.active {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #000;
}
.list-group-item-light {
    background-color: var(--bg);
    color: var(--text);
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.84rem;
}
.breadcrumb-item,
.breadcrumb-item a {
    color: var(--text-3);
    font-size: 0.84rem;
}
.breadcrumb-item a:hover { color: var(--text); }
.breadcrumb-item.active { color: var(--text); font-weight: 600; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-3); }

/* Topbar breadcrumb (Linear-style) */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
}
.breadcrumb-nav span { color: var(--text-3); }
.breadcrumb-nav strong { color: var(--text); font-weight: 600; }

/* ============================================================
   ACCORDION
   ============================================================ */
.accordion-item {
    background-color: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    color: var(--text);
}
.accordion-item:first-of-type { border-radius: 10px 10px 0 0; }
.accordion-item:last-of-type { border-radius: 0 0 10px 10px; }

.accordion-button {
    background-color: var(--bg-raised);
    color: var(--text);
    font-weight: 500;
    font-size: 0.88rem;
    padding: 12px 16px;
}
.accordion-button:not(.collapsed) {
    background-color: var(--bg-hover);
    color: var(--accent);
    box-shadow: none;
}
.accordion-button:focus { box-shadow: none; border-color: var(--accent); }
.accordion-button::after {
    filter: none;
}
[data-theme="dark"] .accordion-button::after,
body.dark-mode .accordion-button::after {
    filter: invert(1) brightness(0.6);
}
.accordion-body {
    background-color: var(--bg-raised);
    color: var(--text);
    padding: 16px 20px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.page-link {
    background-color: var(--bg-raised);
    border-color: var(--border);
    color: var(--text-2);
    font-size: 0.82rem;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.1s;
}
.page-link:hover {
    background-color: var(--bg-hover);
    color: var(--accent);
    border-color: var(--border);
}
.page-item.active .page-link {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #000;
}
.page-item.disabled .page-link {
    background-color: var(--bg);
    color: var(--text-3);
    border-color: var(--border-subtle);
}

/* ============================================================
   TOOLTIPS & POPOVERS
   ============================================================ */
.tooltip-inner {
    background-color: var(--bg-active);
    color: var(--text);
    border-radius: 6px;
    font-size: 0.78rem;
    padding: 4px 10px;
}
.popover {
    background-color: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}
.popover-body { color: var(--text); font-size: 0.84rem; }
.popover-header {
    background-color: var(--bg);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text);
    font-weight: 600;
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress {
    background-color: var(--bg-active);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
}
.progress-bar {
    border-radius: 4px;
}

/* ============================================================
   DATATABLES — Full theme override
   ============================================================ */
.dataTables_wrapper {
    color: var(--text);
    font-size: 0.84rem;
}
.dataTables_wrapper .dataTables_info {
    color: var(--text-3) !important;
    font-size: 0.78rem;
}
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
    color: var(--text) !important;
    font-size: 0.84rem;
}
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper input[type="search"] {
    background-color: var(--bg-raised) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    color: var(--text) !important;
    padding: 4px 10px !important;
    font-size: 0.84rem;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper input[type="search"]:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-soft) !important;
}
.dataTables_wrapper .dataTables_length select {
    background-color: var(--bg-raised) !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
    color: var(--text) !important;
    padding: 2px 6px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-2) !important;
    border-radius: 6px !important;
    border: 1px solid transparent !important;
    padding: 4px 10px !important;
    font-size: 0.82rem;
    transition: all 0.1s;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--bg-hover) !important;
    border-color: var(--border) !important;
    color: var(--accent) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #000 !important;
    font-weight: 600;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: var(--text-3) !important;
    opacity: 0.5;
}
.dataTables_empty { color: var(--text-3) !important; }
.dataTables_wrapper .row { color: var(--text); }

/* DataTables Bootstrap5 thead/tbody/tfoot */
table.dataTable thead th,
table.dataTable thead td,
table.dataTable tfoot th,
table.dataTable tfoot td {
    color: var(--text-2) !important;
    background-color: var(--bg-raised) !important;
    border-color: var(--border-subtle) !important;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
table.dataTable tbody td {
    color: var(--text) !important;
}
table.dataTable.table-striped > tbody > tr:nth-of-type(odd) > * {
    color: var(--text);
    --bs-table-accent-bg: var(--bg-hover);
}
table.dataTable.table-hover > tbody > tr:hover > * {
    color: var(--text);
    --bs-table-accent-bg: var(--bg-active);
}

/* ============================================================
   DROP ZONE (Upload PDF)
   ============================================================ */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    background: var(--bg);
    transition: all 0.2s ease;
    cursor: pointer;
}
.drop-zone:hover,
.drop-zone-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    transform: scale(1.005);
}
.drop-zone-active {
    box-shadow: 0 0 20px rgba(240, 165, 0, 0.15);
}

/* ============================================================
   COLUMN FILTERS & DATE RANGE
   ============================================================ */
.col-filters-row {
    padding: 6px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--border-subtle);
}
.col-filter-input {
    font-size: 0.78rem;
    padding: 2px 8px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
}
.col-filter-input::placeholder { color: var(--text-3); }
.filter-row-toggle { text-align: center; }

.date-range-bar {
    padding: 8px 16px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 0.84rem;
    border: 1px solid var(--border-subtle);
}
.date-range-bar label { font-weight: 500; margin-right: 4px; color: var(--text-2); }
.date-range-bar .form-control {
    display: inline-block;
    width: auto;
    font-size: 0.82rem;
    padding: 3px 8px;
}

/* ============================================================
   EDITABLE COMMENTS
   ============================================================ */
.editable-comment { cursor: pointer; position: relative; }
.editable-comment:hover { background-color: var(--bg-hover) !important; }
.editable-comment .edit-icon { opacity: 0; transition: opacity 0.15s; }
.editable-comment:hover .edit-icon { opacity: 1; }

/* ============================================================
   CHANGELOG
   ============================================================ */
.changelog-entry {
    border-left: 3px solid var(--accent);
    padding: 16px 20px;
    margin-bottom: 12px;
    background: var(--bg-raised);
    border-radius: 0 10px 10px 0;
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent);
}
.changelog-version {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    letter-spacing: -0.02em;
}
.changelog-date {
    font-size: 0.78rem;
    color: var(--text-3);
    font-family: var(--mono);
}
.changelog-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tag-new { background: rgba(48, 209, 88, 0.12); color: var(--green); }
.tag-fix { background: rgba(255, 69, 58, 0.12); color: var(--red); }
.tag-wip { background: rgba(255, 159, 10, 0.12); color: var(--orange); }
.tag-plan { background: rgba(10, 132, 255, 0.12); color: var(--blue); }

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-tabs .nav-link {
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-2);
    border-radius: 8px;
    padding: 6px 14px;
    transition: all 0.1s;
}
.admin-tabs .nav-link:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.admin-tabs .nav-link.active {
    background: var(--accent);
    color: #000;
}
.admin-tabs .nav-link .badge {
    font-size: 0.6rem;
}

.admin-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.84rem;
    color: var(--text);
}
.admin-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.admin-zgl-item {
    transition: background 0.1s;
    border-radius: 6px;
}
.admin-zgl-item:hover {
    background: var(--accent-soft);
}
.admin-zgl-opis {
    max-height: 40px;
    overflow: hidden;
}

.admin-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
}

.admin-role-item {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}
.admin-role-item .badge {
    min-width: 72px;
    text-align: center;
}
.admin-role-item small { color: var(--text-3); }

/* Tabela użytkowników v2 — sortowalne nagłówki + soft warning + kompaktowe kontrolki */
.admin-users-table th.sortable {
    cursor: pointer;
    user-select: none;
}
.admin-users-table th.sortable:hover {
    background: rgba(240, 165, 0, 0.08);
}
.admin-users-table td {
    vertical-align: middle;
}
.admin-users-table .inline-rola {
    min-width: 130px;
    padding-top: 2px;
    padding-bottom: 2px;
}
.admin-users-table .btn-scope .badge {
    cursor: pointer;
    font-weight: 500;
}
tr.table-warning-soft td {
    background: rgba(240, 165, 0, 0.06);
}
tr.table-warning-soft:hover td {
    background: rgba(240, 165, 0, 0.12);
}

.admin-komentarz-item {
    transition: background 0.1s;
    border-radius: 6px;
}
.admin-komentarz-item:hover {
    background: rgba(10, 132, 255, 0.08) !important;
}
.admin-zgl-detail {
    border-top: 1px solid var(--border-subtle);
}
.admin-zgl-detail > div {
    background: var(--bg) !important;
}
.admin-zgl-header:hover {
    background: var(--accent-soft);
}

#emailPreviewFrame {
    background: var(--bg-raised);
}

/* ============================================================
   SKRZYNKA / INBOX
   ============================================================ */
.skrzynka-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}
.skrzynka-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
    border-radius: 0;
}
.skrzynka-item:hover {
    background: var(--bg-hover);
}
.skrzynka-item.active {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
}
.skrzynka-item.nieprzeczytane {
    font-weight: 600;
}
.skrzynka-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin-right: 6px;
    flex-shrink: 0;
}
.skrzynka-dot.przeczytane {
    background: transparent;
}
.skrzynka-typ-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}
.skrzynka-preview {
    padding: 24px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}
.skrzynka-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-3);
}
.skrzynka-preview-empty i {
    font-size: 3rem;
    margin-bottom: 12px;
    color: var(--text-3);
    opacity: 0.4;
}
.skrzynka-meta {
    font-size: 0.82rem;
    color: var(--text-3);
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.skrzynka-body {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text);
}
.skrzynka-reply-box {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 16px;
}
.skrzynka-filter-tabs .btn {
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 20px;
    color: var(--text-2);
    border-color: var(--border);
}
.skrzynka-filter-tabs .btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* ============================================================
   BUG REPORT — Screen drop zone
   ============================================================ */
.screen-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 24px 16px;
    text-align: center;
    background: var(--bg);
    cursor: pointer;
    transition: all 0.15s;
}
.screen-drop-zone:hover,
.screen-drop-zone.screen-drop-active {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.screen-thumb {
    position: relative;
    display: inline-block;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.screen-thumb img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    display: block;
}
.screen-thumb .btn-remove-screen {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
    line-height: 22px;
    padding: 0;
    cursor: pointer;
    transition: background 0.1s;
}
.screen-thumb .btn-remove-screen:hover { background: rgba(255, 69, 58, 0.8); }
.screen-thumb .screen-name {
    display: block;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-3);
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}
.zgloszenie-detail {
    font-size: 0.88rem;
    color: var(--text);
}

/* ============================================================
   TABLE SIZE — User preference
   ============================================================ */
body.table-kompaktowy .data-table { font-size: 0.76rem; }
body.table-kompaktowy .data-table th { font-size: 0.7rem; }
body.table-kompaktowy .data-table td { padding: 2px 6px; }

body.table-duzy .data-table { font-size: 1rem; }
body.table-duzy .data-table th { font-size: 0.92rem; }
body.table-duzy .data-table td { padding: 10px 12px; }

/* ============================================================
   WIP PLACEHOLDER
   ============================================================ */
.wip-placeholder {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-3);
}
.wip-placeholder i {
    font-size: 4rem;
    color: var(--text-3);
    opacity: 0.3;
    display: block;
    margin-bottom: 16px;
}

/* ============================================================
   TOAST
   ============================================================ */
#actionToast {
    /* Pozycja: fixed bottom-right, z-index ponad wszystkim
       (modale Bootstrap = 1055, dropdown = 1000). 2026-05-19:
       max-width zapobiega wyjazdowi długich komunikatów poza ekran,
       word-wrap łamie tekst zamiast obcinać. */
    z-index: 100100 !important;
    max-width: min(420px, calc(100vw - 32px)) !important;
}
/* Override inline style `min-width: 320px` + Bootstrap default --bs-toast-max-width: 350px.
   Bez !important inline win z reguły specyficzności. */
#actionToast .toast {
    --bs-toast-max-width: 100% !important;
    min-width: 250px !important;
    max-width: 100% !important;
    width: 100% !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}
#actionToast .toast .d-flex {
    flex-wrap: nowrap;
    align-items: stretch;
}
#actionToast .toast-body {
    flex: 1 1 auto;
    min-width: 0; /* kluczowe dla flex children żeby pozwolić shrink + word-wrap */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    line-height: 1.4;
    padding: 0.75rem 1rem;
}
#actionToast .btn-close {
    flex: 0 0 auto;
    align-self: flex-start;
    margin-top: 0.5rem !important;
}

/* ============================================================
   KEYBOARD SHORTCUTS
   ============================================================ */
kbd {
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.65rem;
    color: var(--text-3);
    font-family: inherit;
}

/* ============================================================
   LOGIN PAGE (Linear-style)
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.login-box {
    width: 360px;
    text-align: center;
}
.login-box .logo-big {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.4rem;
    font-weight: 800;
    color: #000;
}
.login-box h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}
.login-box p {
    font-size: 0.85rem;
    color: var(--text-3);
    margin-bottom: 28px;
}
.login-field {
    width: 100%;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    margin-bottom: 10px;
}
.login-field:focus { border-color: var(--accent); }
.login-field::placeholder { color: var(--text-3); }
.login-submit {
    width: 100%;
    margin-top: 6px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    padding: 12px;
    color: #000;
    font-weight: 600;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
}
.login-submit:hover { opacity: 0.9; }
.login-footer {
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--text-3);
}

/* ============================================================
   UTILITY OVERRIDES (Bootstrap compat)
   ============================================================ */
.bg-light { background-color: var(--bg) !important; }
.bg-white { background-color: var(--bg-raised) !important; }
.text-muted { color: var(--text-3) !important; }
.text-dark { color: var(--text) !important; }
.text-body { color: var(--text) !important; }
.border { border-color: var(--border) !important; }
.border-bottom { border-bottom-color: var(--border) !important; }
.border-top { border-top-color: var(--border) !important; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.35s ease forwards;
    opacity: 0;
}
.slide-up:nth-child(1) { animation-delay: 0s; }
.slide-up:nth-child(2) { animation-delay: 0.06s; }
.slide-up:nth-child(3) { animation-delay: 0.06s; }
.slide-up:nth-child(4) { animation-delay: 0.12s; }
.slide-up:nth-child(5) { animation-delay: 0.18s; }
.slide-up:nth-child(6) { animation-delay: 0.24s; }

.fade-in {
    animation: fadeIn 0.3s ease forwards;
    opacity: 0;
}

/* Smooth hover transitions on ALL interactive elements */
a, button, .btn, .nav-link, .sidebar-link, .list-group-item,
.dropdown-item, .page-link, .accordion-button {
    transition: all 0.15s ease;
}

/* Dev banner pulse */
@keyframes devPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* ============================================================
   GLOBAL LOADER
   ============================================================ */
#glutenLoader { display: none; }
.gluten-loader-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    z-index: 9998;
}

.gluten-loader-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    text-align: center;
    padding: 2.5rem 3rem;
    background: var(--bg-raised);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-modal);
    min-width: 340px;
    max-width: 480px;
}

.gluten-loader-bar-wrapper {
    width: 100%;
    height: 3px;
    background: var(--bg-active);
    border-radius: 2px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.gluten-loader-bar {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--accent), #ffcc00, var(--accent));
    border-radius: 2px;
    animation: glutenBarSlide 1.8s ease-in-out infinite;
}

@keyframes glutenBarSlide {
    0% { width: 5%; margin-left: 0; }
    50% { width: 40%; margin-left: 30%; }
    100% { width: 5%; margin-left: 95%; }
}

.gluten-loader-icon {
    margin-bottom: 1rem;
}

.gluten-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: glutenSpin 0.8s linear infinite;
}

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

.gluten-loader-text {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    letter-spacing: -0.01em;
}

.gluten-loader-joke {
    color: var(--accent);
    font-size: 0.78rem;
    font-style: italic;
    min-height: 1.2rem;
    line-height: 1.4;
    animation: glutenJokeFade 0.5s ease-in;
    opacity: 0.8;
}

@keyframes glutenJokeFade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 0.8; transform: translateY(0); }
}

/* Loader entry/exit animations */
#glutenLoader.loader-visible .gluten-loader-overlay {
    animation: glutenOverlayIn 0.25s ease-out;
}
#glutenLoader.loader-visible .gluten-loader-content {
    animation: glutenContentIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#glutenLoader.loader-hiding .gluten-loader-overlay {
    animation: glutenOverlayOut 0.2s ease-in forwards;
}
#glutenLoader.loader-hiding .gluten-loader-content {
    animation: glutenContentOut 0.2s ease-in forwards;
}

@keyframes glutenOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes glutenContentIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes glutenOverlayOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes glutenContentOut {
    from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    to { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
}

/* ============================================================
   CUSTOM SCROLLBARS
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-3);
}
::-webkit-scrollbar-corner {
    background: var(--bg);
}
/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Sidebar always dark scrollbars */
.sidebar::-webkit-scrollbar-thumb {
    background: #2a2a2e;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #3a3a3e;
}

/* ============================================================
   RESPONSIVE — Mobile sidebar
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        margin-left: -240px;
    }
    .sidebar.sidebar-open {
        margin-left: 0;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.4);
    }
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .page-content { padding: 16px; }
    .stats-bar { flex-wrap: wrap; }
    .stats-bar .badge { font-size: 0.75rem; }
    .data-table { font-size: 0.78rem; }
    .btn-manual-match, .btn-hide-trans, .btn-delete-match {
        padding: 1px 4px;
        font-size: 0.7rem;
    }
    .stats-row {
        flex-direction: column;
    }
    .stat-block {
        padding: 14px 20px;
    }
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   MOBILE PATTERNS - shared (master-detail, bottom-sheet, chips)
   Used by: skrzynka, czas_pracy, wina, przypomnienia
   Added 2026-05-24 - mobile responsive adaptation Phase 1
   ============================================================ */

/* Domyslnie ukryte na desktop, JS aktywuje na mobile */
.mobile-only-flex { display: none; }

@media (max-width: 767.98px) {

    /* --- Master-Detail layout switcher --- */
    .mobile-master-detail > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .mobile-master-detail.mobile-show-list .col-lg-8,
    .mobile-master-detail.mobile-show-list .col-md-7 {
        display: none;
    }
    .mobile-master-detail.mobile-show-preview .col-lg-4,
    .mobile-master-detail.mobile-show-preview .col-md-5 {
        display: none;
    }

    /* --- Mobile back button --- */
    .mobile-back-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 8px;
        border: 1px solid var(--border);
        background: transparent;
        color: var(--text);
        font-size: 1.1rem;
        margin-right: 8px;
        cursor: pointer;
        transition: background 0.12s;
    }
    .mobile-back-btn:hover,
    .mobile-back-btn:active { background: var(--bg-hover); }
    .mobile-only-flex { display: flex !important; }

    /* --- Touch targets >=44px --- */
    .skrzynka-item { min-height: 56px; }
    #btnOznaczWszystkie,
    #btnSkrzynkaFiltrMobile,
    #btnUsunWiadomosc {
        min-width: 44px;
        min-height: 44px;
    }
    .filter-chip { min-height: 44px; }

    /* --- Lista pelnoekranowa --- */
    .mobile-master-detail #listaWiadomosci {
        max-height: calc(100vh - 180px) !important;
    }

    /* --- Inputy iOS no-zoom (font-size >=16px) --- */
    .mobile-master-detail input[type="text"],
    .mobile-master-detail input[type="search"],
    .mobile-master-detail textarea,
    .mobile-master-detail select,
    .bottom-sheet input[type="text"],
    .bottom-sheet textarea,
    .bottom-sheet select {
        font-size: 16px !important;
    }

    /* --- Spacja na FAB pod tresca podgladu --- */
    .mobile-master-detail #podgladTresc { padding-bottom: 88px; }

    /* --- FAB Odpowiedz --- */
    .mobile-reply-fab {
        position: fixed;
        right: 16px;
        bottom: 16px;
        z-index: 1080;
        padding: 12px 20px;
        border-radius: 28px;
        border: none;
        background: var(--accent);
        color: #000;
        font-weight: 600;
        font-size: 0.95rem;
        box-shadow: var(--shadow-md);
        display: none;
        align-items: center;
        gap: 6px;
        min-height: 48px;
        cursor: pointer;
    }
    .mobile-reply-fab.visible { display: inline-flex; }

    /* --- Stat grid 2x2 (Przypomnienia + reusable dla innych dashboardow) --- */
    .stat-grid-2col-mobile {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .stat-grid-2col-mobile > * {
        min-width: 0;
    }

    /* --- Active filters chips display nad lista (Przypomnienia) --- */
    .mobile-active-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin: 0 0 10px 0;
    }
    .active-filter-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 10px 6px 12px;
        border-radius: 16px;
        background: var(--bg-raised);
        border: 1px solid var(--border);
        font-size: 0.78rem;
        color: var(--text-2);
        min-height: 32px;
    }
    .active-filter-chip .remove-x {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: var(--bg-hover);
        color: var(--text-3);
        text-decoration: none;
        font-size: 1rem;
        line-height: 1;
        cursor: pointer;
    }
    .active-filter-chip .remove-x:hover {
        background: var(--red);
        color: #fff;
    }

    /* --- 3-dots context menu trigger (Przypomnienia, Wina, Czas pracy) --- */
    .mobile-3dots-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 8px;
        border: 1px solid var(--border-subtle);
        background: transparent;
        color: var(--text-2);
        cursor: pointer;
        font-size: 1.1rem;
    }
    .mobile-3dots-btn:active {
        background: var(--bg-hover);
    }
}

/* --- Bottom sheet (mobile drawer-from-bottom) --- */
.bottom-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 1090;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
.bottom-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}
.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1095;
    background: var(--bg-raised);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 85vh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet-short { max-height: 60vh; }
.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 10px auto 4px auto;
}
.bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px 8px 20px;
    border-bottom: 1px solid var(--border);
}
.bottom-sheet-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-2);
    font-size: 1rem;
    cursor: pointer;
}
.bottom-sheet-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.bottom-sheet-body { padding: 16px 20px 24px 20px; }

/* --- Filter chips (bottom-sheet) --- */
.mobile-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.filter-chip {
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
    min-height: 40px;
}
.filter-chip:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.filter-chip.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* --- Action sheet (lista akcji w bottom-sheet, reusowalna w Przypomnienia/Wina/Czas pracy) --- */
.action-sheet .action-sheet-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 60px;
    padding: 16px 24px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}
.action-sheet .action-sheet-item i {
    font-size: 1.15rem;
    width: 24px;
    color: var(--text-2);
    text-align: center;
    flex-shrink: 0;
}
.action-sheet .action-sheet-item:active {
    background: var(--bg-hover);
}
.action-sheet .action-sheet-item:last-child {
    border-bottom: none;
}
.action-sheet .action-sheet-item.danger {
    color: var(--red);
}
.action-sheet .action-sheet-item.danger i {
    color: var(--red);
}
.action-sheet .action-sheet-item.hidden {
    display: none;
}
.action-sheet .bottom-sheet-body.p-0,
.action-sheet > .bottom-sheet-body.p-0 {
    padding: 0;
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
    .sidebar, .topbar, .btn, .modal, #actionToast,
    .filter-row, .dataTables_filter, .dataTables_info,
    .dataTables_paginate, .dataTables_length,
    #devModeBanner, .sidebar-expand-btn {
        display: none !important;
    }
    .main-content { margin-left: 0 !important; }
    body {
        background: #fff !important;
        color: #000 !important;
        overflow: visible !important;
    }
    .page-content {
        overflow: visible !important;
        padding: 0 !important;
    }
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    .row-green { background-color: #c6efce !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .row-red { background-color: #ffc7ce !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .row-orange { background-color: #f4b084 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .row-blue { background-color: #b4c6e7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .row-yellow { background-color: #ffeb9c !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .row-purple { background-color: #d5a6e6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================================
   SIDEBAR SEARCH (Notion-style Cmd+K)
   ============================================================ */
.sidebar-search {
    margin: 8px 12px;
    background: var(--sidebar-hover);
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--sidebar-section-text);
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.15s;
}
.sidebar-search:hover { border-color: var(--sidebar-text-muted); }
.sidebar-search kbd {
    margin-left: auto;
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.65rem;
    color: var(--sidebar-section-text);
    font-family: inherit;
}

/* ============================================================
   PAGE SWITCH (mockup only, kept for compat)
   ============================================================ */
.page-switch {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 999;
    display: flex;
    gap: 4px;
}
.page-switch button {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    transition: all 0.1s;
}
.page-switch button:hover,
.page-switch button.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* ============================================================
   LIGHT THEME BOOTSTRAP NEUTRALIZATION
   Override wymuszonych dark Bootstrap class gdy data-theme="light"
   ============================================================ */

html[data-theme="light"] .modal-content.bg-dark,
html[data-theme="light"] .modal-content {
    background-color: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}
html[data-theme="light"] .modal-content.text-light {
    color: var(--text-primary) !important;
}
html[data-theme="light"] .modal-header.border-secondary,
html[data-theme="light"] .modal-footer.border-secondary {
    border-color: var(--border) !important;
}
html[data-theme="light"] .table-dark,
html[data-theme="light"] .table-dark > thead > tr > th,
html[data-theme="light"] .table-dark > tbody > tr > td,
html[data-theme="light"] .table-dark > tbody > tr > th {
    --bs-table-bg: var(--bg-tertiary);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border);
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}
html[data-theme="light"] .dropdown-menu-dark {
    background-color: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border);
}
html[data-theme="light"] .dropdown-menu-dark .dropdown-item {
    color: var(--text-primary);
}
html[data-theme="light"] .dropdown-menu-dark .dropdown-item:hover,
html[data-theme="light"] .dropdown-menu-dark .dropdown-item:focus {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}
html[data-theme="light"] .bg-dark {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}
html[data-theme="light"] .text-light,
html[data-theme="light"] .text-white {
    color: var(--text-primary) !important;
}
html[data-theme="light"] .text-white-50 {
    color: var(--text-muted) !important;
}
html[data-theme="light"] .border-secondary {
    border-color: var(--border) !important;
}
/* btn-close-white: Bootstrap wymusza filter:invert(1) (bialy X) - w light tle
   X bialy jest niewidoczny, wiec wracamy do ciemnego (filter:none). */
html[data-theme="light"] .btn-close-white {
    filter: none !important;
}
/* navbar-dark: jasne linki nav niewidoczne na jasnym tle */
html[data-theme="light"] .navbar-dark:not(#sidebar):not(#sidebar *) {
    background-color: var(--card-bg) !important;
}
html[data-theme="light"] .navbar-dark:not(#sidebar) .navbar-nav .nav-link,
html[data-theme="light"] .navbar-dark:not(#sidebar) .navbar-brand {
    color: var(--text-primary) !important;
}
/* btn-dark: ciemny przycisk - w light neutralizujemy do powierzchni karty */
html[data-theme="light"] .btn-dark {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}
html[data-theme="light"] .btn-dark:hover {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}
html[data-theme="light"] .modal-backdrop {
    --bs-backdrop-opacity: 0.3;
}
/* WYJATKI: sidebar jest zawsze ciemny - nie podlega light-mode rules */
html[data-theme="light"] #sidebar .text-light,
html[data-theme="light"] #sidebar .text-white {
    color: #ececee !important;
}
html[data-theme="light"] #sidebar .text-muted,
html[data-theme="light"] #sidebar .text-white-50 {
    color: #8b8b92 !important;
}
html[data-theme="light"] #sidebar .border-secondary {
    border-color: #2a2a2e !important;
}

/* ============================================================
   SIDEBAR THEME TOGGLE (button w sidebar-footer)
   ============================================================ */
.sidebar-theme-toggle {
    width: calc(100% - 16px);
    margin: 0 8px 8px 8px;
    padding: 6px 10px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: background 0.12s ease, color 0.12s ease;
}
.sidebar-theme-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}
.sidebar-theme-toggle .theme-toggle-label {
    flex-shrink: 0;
}
.sidebar-theme-toggle .theme-toggle-state {
    margin-left: auto;
    font-weight: 600;
    color: var(--accent);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.sidebar-theme-toggle .theme-icon-light { display: none; }
.sidebar-theme-toggle .theme-icon-dark { display: inline; }
html[data-theme="light"] .sidebar-theme-toggle .theme-icon-light { display: inline; }
html[data-theme="light"] .sidebar-theme-toggle .theme-icon-dark { display: none; }

/* ============================================================
   LIGHT THEME DEPTH / CONTRAST BOOST (2026-05-26 iteracja po feedback usera)
   W light theme tlo strony jest lekko szare (#f5f5f7), karty biale (#ffffff).
   Dodajemy cienie + mocniejsze separatory zeby karty/tabele/przyciski byly
   wyraznie wyodrebnione od tla i od siebie nawzajem.
   ============================================================ */

html[data-theme="light"] .card,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .spolka-card,
html[data-theme="light"] .kafelek,
html[data-theme="light"] .info-card {
    box-shadow: var(--shadow-sm);
    border-color: var(--border);
}
html[data-theme="light"] .card:hover,
html[data-theme="light"] .stat-card:hover,
html[data-theme="light"] .spolka-card:hover {
    box-shadow: var(--shadow-md);
}

/* Tabele - mocniejsze separatory wierszy/kolumn, wyrazne striped */
html[data-theme="light"] .table {
    --bs-table-striped-bg: #f5f5f7;
    --bs-table-hover-bg: #ebebee;
    --bs-table-border-color: var(--border);
}
html[data-theme="light"] .table > thead > tr > th {
    background: var(--bg-secondary) !important;
    border-bottom: 2px solid var(--border) !important;
    font-weight: 600;
    color: var(--text-primary);
}
html[data-theme="light"] .table > tbody > tr > td,
html[data-theme="light"] .table > tbody > tr > th {
    border-color: var(--border-light);
}
html[data-theme="light"] .table-bordered,
html[data-theme="light"] .table-bordered > thead > tr > th,
html[data-theme="light"] .table-bordered > tbody > tr > td {
    border: 1px solid var(--border) !important;
}

/* Przyciski outline - wyrazne kontury (w light bez tla potrzebuja mocnego borderu) */
html[data-theme="light"] .btn-outline-secondary,
html[data-theme="light"] .btn-outline-primary,
html[data-theme="light"] .btn-outline-light,
html[data-theme="light"] .btn-outline-warning {
    border-color: var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
}
html[data-theme="light"] .btn-outline-secondary:hover,
html[data-theme="light"] .btn-outline-primary:hover,
html[data-theme="light"] .btn-outline-light:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Inputy - widoczne ramki */
html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select,
html[data-theme="light"] input[type="text"]:not(.no-style),
html[data-theme="light"] input[type="number"]:not(.no-style),
html[data-theme="light"] input[type="date"]:not(.no-style),
html[data-theme="light"] input[type="email"]:not(.no-style),
html[data-theme="light"] input[type="password"]:not(.no-style),
html[data-theme="light"] select:not(.no-style),
html[data-theme="light"] textarea:not(.no-style) {
    border: 1px solid var(--input-border) !important;
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
}
html[data-theme="light"] .form-control:focus,
html[data-theme="light"] .form-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-subtle) !important;
}

/* Metryki / stat boxes - widoczne separatory miedzy nimi */
html[data-theme="light"] .stat-card,
html[data-theme="light"] .metryka-box,
html[data-theme="light"] [class*="stat-"] {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

/* Sekcje admin/dashboard - cards niech beda wyraznie wyodrebnione od tla */
html[data-theme="light"] .admin-section,
html[data-theme="light"] .panel,
html[data-theme="light"] .widget,
html[data-theme="light"] .dashboard-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* Sekcja tabs - separator pod aktywnym */
html[data-theme="light"] .nav-tabs {
    border-bottom: 2px solid var(--border);
}
html[data-theme="light"] .nav-tabs .nav-link.active {
    border-color: var(--border) var(--border) var(--bg-elevated);
    background: var(--bg-elevated);
}

/* Group headers tabel (PRZYCHODY, GOTOWKA itp w RK) - wyrazne tla */
html[data-theme="light"] thead > tr.group-header > th,
html[data-theme="light"] thead > tr > th.group-header {
    background: var(--bg-tertiary) !important;
    border-bottom: 2px solid var(--border) !important;
}

/* Badge'y z bg-light/secondary - wyrazne kontury w light */
html[data-theme="light"] .badge.bg-light,
html[data-theme="light"] .badge.bg-secondary {
    border: 1px solid var(--border);
}

/* ============================================================
   PANEL WKROTCE - disabled feature placeholder
   Niezawodne blur + badge (CSS class zamiast inline style)
   ============================================================ */
.panel-wkrotce {
    position: relative !important;
    isolation: isolate;
}
.panel-wkrotce > .panel-wkrotce-content {
    filter: blur(5px) !important;
    -webkit-filter: blur(5px) !important;
    opacity: 0.4 !important;
    pointer-events: none !important;
    user-select: none !important;
    transform: translateZ(0);
}
.panel-wkrotce > .panel-wkrotce-overlay {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.05);
    border-radius: inherit;
    z-index: 10;
}
/* EVL-007 fix: w light theme tlo overlay ciemniejsze zeby badge byl lepiej wyodrebniony */
html[data-theme="light"] .panel-wkrotce > .panel-wkrotce-overlay {
    background: rgba(0, 0, 0, 0.12);
}
.panel-wkrotce-badge {
    background: var(--accent) !important;
    color: var(--btn-accent-text) !important;
    border-radius: 999px !important;
    padding: 10px 28px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    letter-spacing: 2px !important;
    text-transform: uppercase !important;
    box-shadow: var(--shadow-lg) !important;
    border: 2px solid var(--accent) !important;
}

/* ============================================================
   A11Y FOCUS RING (2026-05-28)
   Widoczny pierscien focus dla nawigacji klawiatura w obu motywach.
   Mysz (:focus bez :focus-visible) nie pokazuje obwodki -> bez wizualnego
   szumu, ale Tab/Shift+Tab zawsze daje czytelny wskaznik.
   ============================================================ */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
/* login-field ma outline:none - przywracamy ring tylko dla klawiatury */
.login-field:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
