@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #0000ff;
    --primary-light: #eef2ff;
    --primary-dark: #0000cc;
    --black: #1a1a2e;
    --white: #fff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --success: #10b981;
    --success-light: #d1fae5;
    --error: #ef4444;
    --error-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --transition: all .2s ease;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 72px;
    --header-height: 72px;
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #4d4dff;
    --primary-light: #1e1e3f;
    --primary-dark: #6666ff;
    --black: #ffffff;
    --white: #1a1a2e;
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
    --success-light: #064e3b;
    --error-light: #7f1d1d;
    --warning-light: #78350f;
    --danger-light: #7f1d1d;
    --shadow: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.3), 0 2px 4px -1px rgba(0,0,0,.2);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -2px rgba(0,0,0,.2);
}

[data-theme="dark"] .card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-800);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--gray-400);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

.material-icons {
    font-size: 20px;
    vertical-align: middle;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
    color: var(--gray-700);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

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

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

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

.btn-danger:hover {
    background: var(--error);
    color: var(--white);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--white);
    color: var(--gray-800);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--gray-500);
    font-size: 13px;
}

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-error {
    background: var(--error-light);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: var(--success-light);
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}

.card-header > .material-icons {
    color: var(--primary);
    font-size: 22px;
    flex-shrink: 0;
}

.card-header h2 {
    font-size: 15px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--gray-800);
    margin: 0;
}

.card-header h2 .material-icons {
    color: var(--primary);
    font-size: 22px;
    flex-shrink: 0;
}

/* Jeśli card-header ma przycisk/link po prawej */
.card-header .btn,
.card-header a.btn {
    margin-left: auto;
}

.card-body {
    padding: 24px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 18px;
    text-align: left !important;
    border-bottom: 1px solid var(--gray-100);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--gray-500);
    text-align: left !important;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-error {
    background: var(--error-light);
    color: var(--error);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-required {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 10px;
    padding: 2px 6px;
}

.install-page,
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--white) 100%);
}

.install-container,
.login-container {
    background: var(--white);
    padding: 48px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    margin: 20px;
}

.install-header,
.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.install-header h1,
.login-header h1 {
    font-size: 28px;
    color: var(--black);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.install-header h1 img,
.login-header h1 img {
    width: 36px;
    height: 36px;
}

.install-header h1 .material-icons {
    font-size: 36px;
    color: var(--primary);
}

.install-header p,
.login-header p {
    color: var(--gray-500);
}

.install-footer,
.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-100);
    color: var(--gray-500);
    font-size: 13px;
}

.install-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}

.install-steps .step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--gray-400);
    font-size: 14px;
    font-weight: 500;
    background: var(--gray-50);
}

.install-steps .step.active {
    background: var(--primary-light);
    color: var(--primary);
}

.install-steps .step.completed {
    background: var(--success-light);
    color: var(--success);
}

.requirements-list {
    list-style: none;
    margin: 24px 0;
}

.requirements-list li {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.requirements-list li.passed {
    background: var(--success-light);
    color: var(--success);
}

.requirements-list li.failed {
    background: var(--error-light);
    color: var(--error);
}

.modules-list {
    margin: 20px 0;
}

.module-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.module-item:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.module-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 4px;
    accent-color: var(--primary);
}

.module-info {
    display: flex;
    gap: 12px;
    flex: 1;
}

.module-info .material-icons {
    font-size: 28px;
    color: var(--primary);
}

.module-info strong {
    display: block;
    margin-bottom: 4px;
}

.module-info small {
    color: var(--gray-500);
    font-size: 13px;
}

.success-state {
    text-align: center;
    padding: 40px 0;
}

.success-state .success-icon {
    font-size: 80px;
    color: var(--success);
    margin-bottom: 20px;
}

.success-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

.success-state p {
    color: var(--gray-500);
}

.panel-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--black) 100%);
    padding: 20px;
}

.panel-container {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 480px;
}

.panel-header {
    text-align: center;
    margin-bottom: 30px;
}

.panel-header h1 {
    font-size: 24px;
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 4px;
}

.panel-header h1 .material-icons {
    font-size: 32px;
    color: var(--primary);
}

.panel-header p {
    color: var(--gray-500);
    font-size: 14px;
}

.clock-display {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.current-time {
    font-size: 48px;
    font-weight: 700;
    color: var(--black);
    font-variant-numeric: tabular-nums;
}

.current-date {
    font-size: 14px;
    color: var(--gray-500);
    text-transform: capitalize;
}

.pinpad-container {
    margin-bottom: 30px;
}

.pin-display {
    margin-bottom: 20px;
}

.pin-input {
    width: 100%;
    padding: 16px;
    font-size: 32px;
    text-align: center;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--gray-50);
    letter-spacing: 12px;
    font-family: inherit;
    transition: var(--transition);
}

.pin-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.pinpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.pin-btn {
    padding: 20px;
    font-size: 24px;
    font-weight: 600;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    transform: scale(1.02);
}

.pin-btn:active {
    transform: scale(0.98);
    background: var(--gray-100);
}

.pin-btn .material-icons {
    font-size: 28px;
}

.pin-clear {
    color: var(--warning);
}

.pin-clear:hover {
    background: var(--warning-light);
    border-color: var(--warning);
}

.pin-submit {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}

.pin-submit:hover {
    background: #0d9668;
    border-color: #0d9668;
}

.message-container {
    min-height: 60px;
    margin-bottom: 20px;
}

.message {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-success {
    background: var(--success-light);
    color: #15803d;
    border: 1px solid #86efac;
}

.message-error {
    background: var(--error-light);
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.message-info {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #a5b4fc;
}

.active-employees {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.active-employees h3 {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.active-employees h3 .material-icons {
    color: var(--primary);
}

.employee-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.employee-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--white);
    border-radius: 20px;
    font-size: 13px;
    box-shadow: var(--shadow);
}

.employee-badge .material-icons {
    font-size: 18px;
    color: var(--success);
}

.employee-badge small {
    color: var(--gray-400);
    font-size: 11px;
}

.no-employees {
    color: var(--gray-400);
    font-size: 14px;
    text-align: center;
    padding: 10px;
}

.panel-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--gray-100);
}

.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-400);
    font-size: 13px;
    transition: var(--transition);
}

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

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
    transition: width 0.3s ease;
    flex-shrink: 0;
    overflow: hidden;
}

/* Sidebar collapsed state */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    overflow: visible;
}

.sidebar.collapsed .sidebar-nav {
    overflow: visible;
    padding: 16px 0;
}

/* Sidebar nav scrollable */
.sidebar:not(.collapsed) .sidebar-nav {
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed .sidebar-header h2 span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .nav-module-title,
.sidebar.collapsed .nav-module-arrow,
.sidebar.collapsed .nav-module-items,
.sidebar.collapsed .sidebar-footer p {
    display: none !important;
}

.sidebar.collapsed .sidebar-header {
    padding: 20px 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-header h2 {
    justify-content: center;
    width: 100%;
}

.sidebar.collapsed .sidebar-header h2 img {
    margin: 0 auto;
}

.sidebar.collapsed .nav-item,
.sidebar.collapsed .nav-module-header {
    justify-content: center;
    padding: 12px 24px;
}

.sidebar.collapsed .nav-item span:not(.material-icons) {
    display: none !important;
}

.sidebar.collapsed .nav-item .material-icons,
.sidebar.collapsed .nav-module-header .material-icons:first-child {
    margin: 0;
}

/* Ukryj rozwinięte podmenu w collapsed */
.sidebar.collapsed .nav-module.expanded .nav-module-items {
    display: none !important;
    max-height: 0 !important;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-item,
.sidebar.collapsed .nav-module {
    position: relative;
}

.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--gray-800);
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Submenu popup for collapsed sidebar */
.sidebar.collapsed .nav-module .nav-module-popup {
    position: absolute;
    left: calc(100% + 10px);
    top: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 8px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.sidebar.collapsed .nav-module:hover .nav-module-popup {
    opacity: 1;
    visibility: visible;
}

.sidebar.collapsed .nav-module .nav-module-popup .popup-title {
    padding: 8px 12px;
    font-weight: 600;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 4px;
}

.sidebar.collapsed .nav-module .nav-module-popup .nav-subitem {
    padding: 10px 12px;
}

.sidebar-overlay {
    display: none;
}

.sidebar-header {
    padding: 0 24px;
    border-bottom: 1px solid var(--gray-100);
    height: var(--header-height);
    display: flex;
    align-items: center;
    transition: padding 0.3s ease;
}

.sidebar-header h2 {
    font-size: 20px;
    color: var(--black);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    position: relative;
}

.sidebar-header h2 span {
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.sidebar-header h2 img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.sidebar-header h2 .material-icons {
    font-size: 28px;
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    padding: 24px 16px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--gray-600);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease, gap 0.3s ease;
    margin-bottom: 4px;
    font-weight: 500;
    position: relative;
}

.nav-item span:not(.material-icons) {
    flex: 1;
    transition: opacity 0.2s ease 0.1s, width 0.2s ease, flex 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover {
    background: var(--gray-50);
    color: var(--gray-800);
    text-decoration: none;
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item .material-icons {
    font-size: 22px;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

/* Rozwijane menu modułów */
.nav-module {
    margin-bottom: 4px;
}

.nav-module-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--gray-600);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.nav-module-header:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}

.nav-module.expanded .nav-module-header {
    color: var(--primary);
}

.nav-module-header .material-icons:first-child {
    font-size: 22px;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.nav-module-title {
    flex: 1;
    transition: opacity 0.2s ease 0.1s, width 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.nav-module-arrow {
    font-size: 20px !important;
    transition: transform 0.2s ease;
    color: var(--gray-400);
}

.nav-module.expanded .nav-module-arrow {
    transform: rotate(180deg);
    color: var(--primary);
}

.nav-module-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 12px;
}

.nav-module.expanded .nav-module-items {
    max-height: 500px;
}

.nav-subitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 10px 24px;
    color: var(--gray-500);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    margin-bottom: 2px;
    font-size: 14px;
    font-weight: 400;
    position: relative;
}

.nav-subitem:hover {
    background: var(--gray-50);
    color: var(--gray-700);
    text-decoration: none;
}

.nav-subitem.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.nav-subitem .material-icons {
    font-size: 18px;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-100);
    color: var(--gray-400);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar.collapsed .sidebar-footer {
    flex-direction: column;
    padding: 12px 8px;
}

/* Hide popup when sidebar is not collapsed */
.nav-module-popup {
    display: none;
}

.sidebar.collapsed .nav-module-popup {
    display: block;
}

/* Sidebar toggle button */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--gray-600);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.sidebar.collapsed .sidebar-toggle {
    margin: 0 auto;
}

/* Theme toggle button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--gray-600);
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--gray-200);
    color: var(--warning);
}

[data-theme="dark"] .theme-toggle {
    background: var(--gray-200);
    color: var(--warning);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    background: var(--gray-50);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    overflow-x: hidden;
    box-sizing: border-box;
    width: calc(100% - var(--sidebar-width));
}

/* When sidebar is collapsed - use html class for instant apply */
html.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

html.sidebar-collapsed .main-content,
body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

/* Prevent layout shift during sidebar transition */
html, body {
    overflow-x: hidden;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    height: var(--header-height);
}

.mobile-menu-toggle {
    display: none;
}

.top-bar h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--black);
    margin: 0;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.user-badge:hover {
    background: var(--gray-200);
    color: var(--gray-800);
    text-decoration: none;
}

.user-badge .material-icons {
    font-size: 20px;
}

/* Header action button - globalny styl dla przycisków w headerze */
.header-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--gray-600);
    transition: var(--transition);
    position: relative;
}

.header-action-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.header-action-btn .material-icons {
    font-size: 20px;
}

[data-theme="dark"] .header-action-btn {
    background: var(--gray-200);
}

/* Theme toggle button - dziedziczy po header-action-btn */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--gray-600);
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--gray-200);
    color: var(--warning);
}

[data-theme="dark"] .theme-toggle {
    background: var(--gray-200);
    color: var(--warning);
}

/* Messages header widget */
.messages-header-widget {
    position: relative;
}

.messages-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--gray-600);
    transition: var(--transition);
    position: relative;
}

.messages-header-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.messages-header-btn .material-icons {
    font-size: 20px;
}

.messages-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.messages-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: -8px;
    width: 360px;
    max-width: calc(100vw - 100px);
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.messages-dropdown.active {
    display: block;
}

.messages-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.messages-dropdown-header h4 {
    margin: 0;
    font-size: 15px;
    color: var(--black);
}

.messages-dropdown-header .btn-icon-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
}

.messages-dropdown-header .btn-icon-sm:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.messages-dropdown-header .btn-icon-sm .material-icons {
    font-size: 18px;
}

.messages-dropdown-list {
    max-height: 320px;
    overflow-y: auto;
}

.messages-dropdown-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--gray-100);
}

.messages-dropdown-item:last-child {
    border-bottom: none;
}

.messages-dropdown-item:hover {
    background: var(--gray-50);
}

.messages-dropdown-item.unread {
    background: var(--primary-light);
}

.messages-dropdown-empty {
    padding: 30px 20px;
    text-align: center;
    color: var(--gray-500);
}

.messages-dropdown-empty .material-icons {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.messages-dropdown-empty p {
    margin: 0;
}

.dropdown-msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--gray-500);
}

.dropdown-msg-avatar .material-icons {
    font-size: 18px;
}

.dropdown-msg-content {
    flex: 1;
    min-width: 0;
}

.dropdown-msg-name {
    font-weight: 500;
    color: var(--black);
    font-size: 14px;
}

.dropdown-msg-preview {
    font-size: 13px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.dropdown-msg-time {
    font-size: 11px;
    color: var(--gray-500);
    flex-shrink: 0;
}

.messages-dropdown-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-200);
    text-align: center;
}

.messages-dropdown-footer a {
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
}

/* Dark mode for messages dropdown */
[data-theme="dark"] .messages-dropdown {
    background: var(--white);
    border-color: var(--gray-200);
}

[data-theme="dark"] .messages-dropdown-header {
    border-color: var(--gray-200);
}

[data-theme="dark"] .messages-dropdown-item {
    border-color: var(--gray-200);
}

[data-theme="dark"] .messages-dropdown-item:hover {
    background: var(--gray-100);
}

[data-theme="dark"] .messages-dropdown-item.unread {
    background: var(--primary-light);
}

[data-theme="dark"] .messages-dropdown-footer {
    border-color: var(--gray-200);
}

[data-theme="dark"] .dropdown-msg-avatar {
    background: var(--gray-200);
}

/* === Toast Notifications (global) === */
.message-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 400px;
    border-left: 4px solid var(--primary);
}

.message-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.message-toast .material-icons {
    font-size: 24px;
    color: var(--primary);
}

.message-toast .toast-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message-toast .toast-content strong {
    font-size: 14px;
    color: var(--black);
}

.message-toast .toast-content span {
    font-size: 13px;
    color: var(--gray-600);
}

.message-toast .toast-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--gray-400);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-toast .toast-close:hover {
    color: var(--gray-700);
}

.message-toast .toast-close .material-icons {
    font-size: 18px;
    color: inherit;
}

[data-theme="dark"] .message-toast {
    background: var(--gray-800);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .message-toast .toast-content strong {
    color: var(--white);
}

[data-theme="dark"] .message-toast .toast-content span {
    color: var(--gray-300);
}

.content-area {
    padding: 32px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card .stat-icon.blue {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card .stat-icon.green {
    background: var(--success-light);
    color: var(--success);
}

.stat-card .stat-icon.yellow {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-card .stat-icon.orange {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.stat-card .stat-icon.red {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-card-danger {
    border-left: 4px solid var(--danger);
    background: var(--danger-light);
}

.stat-card .stat-icon .material-icons {
    font-size: 28px;
}

.stat-info .stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--black);
}

.stat-info .stat-label {
    color: var(--gray-500);
    font-size: 14px;
}

.page-actions {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .material-icons {
    font-size: 64px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--gray-500);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-100);
    flex-wrap: wrap;
}

/* Language Switcher */
.lang-switcher {
    position: relative;
}
.lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--gray-600);
    transition: var(--transition);
}
.lang-btn:hover {
    background: var(--gray-200);
}
.lang-btn img {
    width: 22px;
    height: 16px;
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0,0,0,0.3);
}
.lang-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
}
.lang-menu.show {
    display: block;
}
.lang-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--gray-700);
    text-decoration: none;
    transition: var(--transition);
}
.lang-item img {
    width: 24px;
    height: 18px;
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0,0,0,0.3);
}
.lang-item:hover {
    background: var(--gray-50);
}
.lang-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* Checkboxy globalne - custom style */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-label .checkbox-custom {
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: 2px solid var(--gray-300);
    border-radius: 3px;
    background: var(--white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-label .checkbox-custom::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.15s ease;
    margin-bottom: 2px;
}

.checkbox-label:hover .checkbox-custom {
    border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    transform: rotate(45deg) scale(1);
}

.checkbox-label input[type="checkbox"]:focus + .checkbox-custom {
    box-shadow: 0 0 0 3px var(--primary-light);
}

.checkbox-label span:last-child {
    white-space: nowrap;
}

/* Checkbox inline - prosty styl */
.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Tabele responsywne */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Główny content - zapobieganie overflow */
/* Usunięto duplikat - główna definicja jest wyżej */

.content-area {
    padding: 32px;
    max-width: 100%;
    overflow-x: hidden;
}

/* Karty - zapobieganie overflow */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    overflow: hidden;
    max-width: 100%;
}

.card-body {
    padding: 24px;
    overflow-x: auto;
}

/* Filtry responsywne */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-row .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

.filter-row .form-group:last-child {
    flex: 0 0 auto;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 20px;
}

/* Responsywność */
@media (max-width: 1024px) {
    .filter-row {
        flex-direction: column;
    }
    
    .filter-row .form-group {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px !important;
        z-index: 1000;
        transition: left 0.3s ease;
        display: block;
    }
    
    /* Na mobile sidebar nie może być collapsed - ukryj przycisk zwijania */
    .sidebar .sidebar-toggle {
        display: none !important;
    }
    
    /* Na mobile sidebar nie może być collapsed */
    .sidebar.collapsed {
        width: 280px !important;
    }
    
    /* Resetuj wszystkie style collapsed na mobile */
    .sidebar.collapsed .sidebar-header h2 span,
    .sidebar.collapsed .nav-section,
    .sidebar.collapsed .nav-item span:not(.material-icons),
    .sidebar.collapsed .nav-module-title,
    .sidebar.collapsed .nav-module-arrow,
    .sidebar.collapsed .nav-module-items,
    .sidebar.collapsed .sidebar-footer p {
        display: block !important;
        opacity: 1 !important;
        width: auto !important;
        position: static !important;
    }
    
    .sidebar.collapsed .nav-item,
    .sidebar.collapsed .nav-module-header {
        justify-content: flex-start !important;
        padding: 12px 16px !important;
    }
    
    .sidebar.mobile-open {
        left: 0;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
        overflow-y: auto;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: var(--white);
        border: 1px solid var(--gray-200);
        cursor: pointer;
        color: var(--gray-700);
        border-radius: var(--radius);
        transition: all 0.2s;
    }
    
    .mobile-menu-toggle:hover {
        background: var(--gray-50);
        border-color: var(--primary);
        color: var(--primary);
    }
    
    .mobile-menu-toggle .material-icons {
        font-size: 26px;
    }
    
    /* Dodaj padding-top dla main-content żeby zrobić miejsce na hamburger */
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
    }
    
    /* Header z logo po prawej stronie - miejsce na hamburger */
    .sidebar-header {
        padding: 16px 20px;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar.mobile-open + .app-container + .sidebar-overlay,
    body:has(.sidebar.mobile-open) .sidebar-overlay {
        display: block;
        opacity: 1;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
    }

    .content-area {
        padding: 16px;
    }
    
    .top-bar {
        flex-wrap: nowrap;
        gap: 8px;
        padding: 12px 16px;
        height: auto;
        min-height: 56px;
    }
    
    /* Mobile: hamburger z lewej */
    .top-bar .mobile-menu-toggle {
        position: static;
        order: -1;
        flex-shrink: 0;
    }
    
    /* Mobile: ukryj tytuł strony */
    .top-bar h1 {
        display: none;
    }
    
    /* Mobile: przyciski akcji zajmują miejsce tytułu */
    .top-bar-actions {
        flex: 1;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 8px;
    }
    
    .top-bar-actions .header-action-btn,
    .top-bar-actions .messages-header-btn,
    .top-bar-actions .theme-toggle,
    .top-bar-actions .lang-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    
    /* Menu języka - otwieraj w lewą stronę na mobile */
    .lang-menu {
        right: auto;
        left: 0;
    }
    
    /* Mobile: user-badge - tylko ikona, klikalny */
    .user-badge {
        padding: 8px;
        width: 40px;
        height: 40px;
    }
    
    .user-badge span:not(.material-icons) {
        display: none;
    }
    
    .user-badge .material-icons {
        margin: 0;
    }
    
    /* Mobile: przycisk wylogowania - tylko ikona */
    .top-bar-actions > a.btn {
        padding: 8px 12px;
        border-radius: var(--radius-sm);
    }
    
    .top-bar-actions > a.btn span:not(.material-icons) {
        display: none;
    }
    
    /* Mobile: dropdown wiadomości - na górze, nie na dole */
    .messages-dropdown {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 80px);
    }
}

/* ======================================
   MODUŁ ZADAŃ - STYLE
   ====================================== */

/* Badge kategorii */
.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    color: white;
    font-size: 0.8em;
    font-weight: 500;
    white-space: nowrap;
}

/* Badge statusu */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8em;
    font-weight: 500;
    white-space: nowrap;
}

.status-active {
    background: var(--warning-light);
    color: #92400e;
}

.status-completed {
    background: var(--success-light);
    color: #065f46;
}

/* Grupa przycisków akcji */
.btn-group {
    display: inline-flex;
    gap: 4px;
    flex-wrap: nowrap;
}

.btn-group form {
    display: inline;
}

/* Tekst pomocniczy */
.text-muted {
    color: var(--gray-500);
}

/* Pusty stan */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state .material-icons {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    font-size: 16px;
}

/* Pasek filtrów */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar > span {
    font-weight: 500;
    color: var(--gray-600);
}

/* ======================================
   UPLOADER MODUŁÓW ZIP
   ====================================== */

.upload-form {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    background: var(--gray-50);
    transition: var(--transition);
    cursor: pointer;
    min-height: 180px;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone .material-icons {
    font-size: 48px;
    color: var(--gray-400);
    margin-bottom: 16px;
}

.upload-zone:hover .material-icons {
    color: var(--primary);
}

.upload-zone-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.upload-zone-hint {
    font-size: 13px;
    color: var(--gray-500);
}

.upload-zone input[type="file"] {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

.upload-selected {
    display: none;
    margin-top: 16px;
    padding: 14px 18px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    align-items: center;
    gap: 12px;
}

.upload-selected.visible {
    display: flex;
}

.upload-selected .material-icons {
    color: var(--success);
    font-size: 28px;
}

.upload-selected-info {
    flex: 1;
    min-width: 0;
}

.upload-selected-name {
    font-weight: 500;
    color: var(--gray-800);
    word-break: break-all;
}

.upload-selected-size {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.upload-selected-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.upload-selected-remove:hover {
    color: var(--error);
    background: var(--error-light);
}

.upload-actions {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

/* Tabela - poprawki dla modułu zadań */
.table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table td {
    font-size: 14px;
}

/* Responsywność tabeli */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .table th,
    .table td {
        padding: 10px 12px;
    }
    
    .btn-group {
        flex-direction: column;
    }
}

/* ======================================
   POPRAWKI UKŁADU - FORMULARZE
   ====================================== */

/* Formularz grid - responsywny układ */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Form row - elastyczny układ kolumn */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

.form-row .form-group {
    margin-bottom: 0;
}

/* Specyficzne układy */
.form-row-4 {
    grid-template-columns: 1fr 2fr 1fr 1fr;
}

.form-row-3 {
    grid-template-columns: 2fr 1fr auto;
}

.form-row-2 {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
    .form-row,
    .form-row-4,
    .form-row-3,
    .form-row-2 {
        grid-template-columns: 1fr;
    }
}

/* Wskazówka formularza */
.form-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 8px;
    padding: 10px 14px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.form-hint .material-icons {
    font-size: 18px;
    color: var(--primary);
}

/* Input readonly */
.input-readonly {
    background: var(--gray-100) !important;
    color: var(--gray-600) !important;
    cursor: not-allowed;
}

/* Stats grid - poprawiony układ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stats-grid .stat-card {
    margin-bottom: 0;
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-card .stat-icon .material-icons {
    font-size: 26px;
}

.stat-card .stat-info .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

.stat-card .stat-info .stat-label {
    font-size: 13px;
    color: var(--gray-500);
}

/* Card body padding fix */
.card-body .form-group:last-child {
    margin-bottom: 0;
}

/* Form actions fix */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-100);
    flex-wrap: wrap;
}

/* Alert z ikoną */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert.success {
    background: var(--success-light);
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.alert.error {
    background: var(--error-light);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Tabela - poprawki wyrównania */
.table td .text-muted {
    display: block;
    font-size: 0.85em;
    margin-top: 2px;
}

/* Buttons w formularzu inline */
.btn-group .btn {
    white-space: nowrap;
}

/* Color input fix */
input[type="color"] {
    height: 44px;
    padding: 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* Przycisk secondary */
.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border-color: var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

/* Przycisk warning */
.btn-warning {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
}

/* Przycisk danger */
.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

/* Przycisk success */
.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 16px;
    color: var(--gray-800);
}

.modal-header .material-icons {
    color: var(--primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--gray-700);
}

.modal-content form {
    padding: 20px;
}

.modal-content .form-group {
    margin-bottom: 16px;
}

.modal-content .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

.modal-content .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 255, 0.1);
}

.modal-content .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
    margin-top: 10px;
}

/* Paginacja */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px;
    border-top: 1px solid var(--gray-200);
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

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

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn .material-icons {
    font-size: 18px;
}

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

.pagination-info {
    margin-left: 16px;
    font-size: 13px;
    color: var(--gray-500);
}

@media (max-width: 768px) {
    .pagination {
        gap: 4px;
    }
    
    .pagination-btn {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 13px;
    }
    
    .pagination-info {
        width: 100%;
        text-align: center;
        margin: 10px 0 0 0;
    }
}

