:root {
    --sidebar-bg: #1a1d23;
    --sidebar-hover: #2a2d35;
    --sidebar-active: #e8720c;
    --sidebar-text: #9ca3af;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 260px;
    --primary: #e8720c;
    --primary-light: #f59e3b;
    --primary-dark: #c25e0a;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e3b;
    --info: #3b82f6;
    --topbar-height: 64px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-info { color: var(--info); }

/* ===== LOGIN SCREEN ===== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1d23 0%, #2d3748 50%, #1a1d23 100%);
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(232,114,12,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.login-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 48px 40px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
    font-size: 32px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.login-field {
    margin-bottom: 20px;
}

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-field label i {
    width: 16px;
    color: var(--primary);
}

.login-field input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.login-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,114,12,0.15);
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232,114,12,0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* ===== APP LAYOUT ===== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo > i {
    font-size: 28px;
    color: var(--primary);
}

.sidebar-title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.sidebar-subtitle {
    display: block;
    font-size: 12px;
    color: var(--sidebar-text);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #e5e7eb;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

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

.logout-btn:hover {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
}

.breadcrumb {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.breadcrumb span {
    color: var(--text-secondary);
    font-weight: 400;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notifications {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: background 0.15s;
}

.notifications:hover {
    background: var(--bg);
}

.notifications i {
    font-size: 18px;
    color: var(--text-secondary);
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.user-role {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ===== NOTIFICATIONS PANEL ===== */
.notifications-panel {
    position: fixed;
    top: var(--topbar-height);
    right: 24px;
    width: 380px;
    max-height: 480px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
    border: 1px solid var(--border);
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.notif-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.notif-count {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

.notif-list {
    max-height: 400px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    cursor: pointer;
}

.notif-item:hover {
    background: #f9fafb;
}

.notif-item.notif-unread {
    background: #fffbeb;
}

.notif-item i {
    font-size: 18px;
    margin-top: 2px;
}

.notif-item p {
    font-size: 13px;
    color: var(--text);
}

.notif-item .notif-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

/* ===== MODULE CONTENT ===== */
.module-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ===== DASHBOARD ===== */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.15s, box-shadow 0.15s;
}

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

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.metric-icon.primary { background: rgba(232,114,12,0.12); color: var(--primary); }
.metric-icon.success { background: rgba(16,185,129,0.12); color: var(--success); }
.metric-icon.warning { background: rgba(245,158,59,0.12); color: var(--warning); }
.metric-icon.danger { background: rgba(239,68,68,0.12); color: var(--danger); }

.metric-info h3 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}

.metric-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dashboard-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.card-header .badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-danger { background: #fef2f2; color: var(--danger); }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-info { background: #eff6ff; color: var(--info); }

.card-body {
    padding: 20px 24px;
}

.alert-list {
    list-style: none;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.alert-icon.danger { background: #fef2f2; color: var(--danger); }
.alert-icon.warning { background: #fffbeb; color: var(--warning); }
.alert-icon.info { background: #eff6ff; color: var(--info); }

.alert-content p {
    font-size: 13px;
    font-weight: 500;
}

.alert-content span {
    font-size: 12px;
    color: var(--text-secondary);
}

.chart-container {
    position: relative;
    height: 280px;
    padding: 16px;
}

#map-container {
    height: 280px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ===== OFERTY / TABLES ===== */
.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.module-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.module-header .count {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 16px;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(232,114,12,0.3);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.tabs-bar {
    display: flex;
    gap: 0;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow-x: auto;
}

.tab-item {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.15s;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-item:hover {
    color: var(--text);
    background: #f9fafb;
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-count {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.tab-item.active .tab-count {
    background: rgba(232,114,12,0.12);
    color: var(--primary);
}

.filters-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
}

.filter-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    background: var(--card-bg);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.search-input {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    width: 240px;
    outline: none;
    background: var(--card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 12px center;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,114,12,0.1);
}

.data-table-wrapper {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.data-table th {
    text-align: left;
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 14px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.data-table tr:hover td {
    background: #f9fafb;
}

.data-table tr.row-warning td {
    background: #fffbeb;
}

.data-table tr.row-warning:hover td {
    background: #fef3c7;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-new { background: #eff6ff; color: #2563eb; }
.status-contact { background: #fff7ed; color: #c2410c; }
.status-sent { background: #f0fdf4; color: #16a34a; }
.status-negotiation { background: #fdf4ff; color: #9333ea; }
.status-won { background: #f0fdf4; color: #15803d; }
.status-lost { background: #fef2f2; color: #dc2626; }
.status-verification { background: #fffbeb; color: #d97706; }
.status-assigned { background: #eff6ff; color: #2563eb; }
.status-inprogress { background: #fff7ed; color: #c2410c; }
.status-parts { background: #fdf4ff; color: #9333ea; }
.status-closed { background: #f3f4f6; color: #6b7280; }

.priority-badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.priority-high { background: #fef2f2; color: var(--danger); }
.priority-normal { background: #f3f4f6; color: var(--text-secondary); }
.priority-low { background: #f0fdf4; color: var(--success); }

.date-overdue {
    color: var(--danger);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.link-cell {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.link-cell:hover {
    text-decoration: underline;
}

/* ===== KONTRAHENCI ===== */
.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.company-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid var(--border);
}

.company-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.company-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.company-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.company-industry {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(232,114,12,0.1);
    color: var(--primary);
}

.company-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.company-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.company-detail i {
    width: 16px;
    color: var(--primary);
    font-size: 12px;
}

.company-stats {
    display: flex;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.company-stat {
    text-align: center;
    flex: 1;
}

.company-stat .stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.company-stat .stat-label {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ===== COMPANY DETAIL VIEW ===== */
.company-detail-view {
    max-width: 1000px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 20px;
    text-decoration: none;
    background: none;
    border: none;
}

.back-btn:hover {
    text-decoration: underline;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.detail-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.detail-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.detail-card .card-header {
    padding: 16px 20px;
}

.detail-card .card-body {
    padding: 16px 20px;
}

.detail-field {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.detail-field:last-child {
    border-bottom: none;
}

.detail-field .label {
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-field .value {
    font-weight: 600;
    color: var(--text);
}

.lang-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.lang-pl { background: #fef2f2; color: #dc2626; }
.lang-en { background: #eff6ff; color: #2563eb; }
.lang-de { background: #fffbeb; color: #d97706; }

.source-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    background: #f3f4f6;
    color: var(--text-secondary);
}

.warranty-active {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: #f0fdf4;
    color: var(--success);
}

.warranty-expired {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: #fef2f2;
    color: var(--danger);
}

.timeline {
    list-style: none;
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-date {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.timeline-content {
    font-size: 13px;
    color: var(--text);
    margin-top: 4px;
}

.timeline-author {
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
}

/* ===== SERVIS ===== */
.full-width {
    grid-column: 1 / -1;
}

/* ===== PIPELINE B2B ===== */
.pipeline-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.pipeline-column {
    min-width: 260px;
    flex: 1;
    background: var(--bg);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
}

.pipeline-column-header {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pipeline-column-count {
    background: rgba(0,0,0,0.08);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.pipeline-column-body {
    padding: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pipeline-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: box-shadow 0.15s;
    border-left: 3px solid var(--primary);
}

.pipeline-card:hover {
    box-shadow: var(--shadow-md);
}

.pipeline-card-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.pipeline-card-company {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.pipeline-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pipeline-card-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.pipeline-card-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.pipeline-col-new .pipeline-column-header { color: var(--info); }
.pipeline-col-contact .pipeline-column-header { color: var(--warning); }
.pipeline-col-sent .pipeline-column-header { color: #16a34a; }
.pipeline-col-negotiation .pipeline-column-header { color: #9333ea; }
.pipeline-col-won .pipeline-column-header { color: var(--success); }
.pipeline-col-lost .pipeline-column-header { color: var(--danger); }

.pipeline-col-new .pipeline-card { border-left-color: var(--info); }
.pipeline-col-contact .pipeline-card { border-left-color: var(--warning); }
.pipeline-col-sent .pipeline-card { border-left-color: #16a34a; }
.pipeline-col-negotiation .pipeline-card { border-left-color: #9333ea; }
.pipeline-col-won .pipeline-card { border-left-color: var(--success); }
.pipeline-col-lost .pipeline-card { border-left-color: var(--danger); }

/* ===== AUTOMATYZACJE ===== */
.automation-list {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.automation-item {
    display: grid;
    grid-template-columns: 2fr 2fr 100px;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

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

.automation-item:hover {
    background: #f9fafb;
}

.automation-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
}

.automation-trigger i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 14px;
    background: rgba(232,114,12,0.1);
    color: var(--primary);
}

.automation-action {
    font-size: 13px;
    color: var(--text-secondary);
}

.automation-status {
    text-align: center;
}

.status-active {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: #f0fdf4;
    color: var(--success);
}

.status-paused {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: #fef2f2;
    color: var(--danger);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .menu-toggle {
        display: block;
    }
    .metrics-row {
        grid-template-columns: 1fr;
    }
    .companies-grid {
        grid-template-columns: 1fr;
    }
    .pipeline-board {
        flex-direction: column;
    }
    .pipeline-column {
        min-width: 100%;
    }
    .user-info {
        display: none;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

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

/* ===== OVERLAY ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

@media (max-width: 768px) {
    .sidebar.open + .sidebar-overlay {
        display: block;
    }
}

.sidebar-overlay.active {
    display: block;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--border);
}

.empty-state p {
    font-size: 14px;
}

/* ===== TABLE FOOTER ===== */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}

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

.module-content > * {
    animation: fadeIn 0.2s ease-out;
}

.contact-person-block {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.contact-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.data-table tfoot td {
    border-bottom: none;
}

.data-table th i {
    margin-right: 4px;
}

.detail-field .value a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
}

.detail-field .value a:hover {
    text-decoration: underline;
}

.timeline-item[style*="--dot-color"]::before {
    background: var(--dot-color, var(--primary));
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--dot-color, var(--primary));
}

.detail-header .status-badge {
    font-size: 14px;
    padding: 8px 16px;
}

.analytics-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.analytics-metric-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.analytics-metric-card .metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.analytics-metric-card .metric-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.analytics-metric-card .metric-trend {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

.analytics-metric-card .metric-trend.up {
    color: var(--success);
}

.analytics-metric-card .metric-trend.down {
    color: var(--danger);
}

/* ===== DEMO BANNERS ===== */
.demo-banner-login {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(90deg, #fef3c7 0%, #fde68a 50%, #fef3c7 100%);
    color: #92400e;
    text-align: center;
    padding: 10px 20px;
    font-size: 13px;
    border-bottom: 2px solid #f59e3b;
}

.demo-banner-login i {
    margin-right: 4px;
}

.login-screen {
    padding-top: 44px;
}

.demo-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 14px;
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.demo-banner-app {
    background: linear-gradient(90deg, #fef3c7 0%, #fde68a 50%, #fef3c7 100%);
    color: #92400e;
    text-align: center;
    padding: 7px 20px;
    font-size: 12px;
    border-bottom: 2px solid #f59e3b;
    flex-shrink: 0;
}

.demo-banner-app i {
    margin-right: 4px;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.modal-close:hover {
    background: #e5e7eb;
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: #f9fafb;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,114,12,0.12);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ===== STATUS CHANGE DROPDOWN ===== */
.status-change-wrap {
    position: relative;
    display: inline-block;
}

.status-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 100;
    min-width: 200px;
    padding: 6px;
    margin-top: 4px;
}

.status-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
    transition: background 0.1s;
}

.status-dropdown-item:hover {
    background: var(--bg);
}

.status-dropdown-item.current {
    font-weight: 700;
    background: var(--bg);
}

/* ===== PIPELINE CARD ACTIONS ===== */
.pipeline-card-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.pipeline-card-actions button {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.pipeline-card-actions button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pipeline-card-actions button.del:hover {
    background: var(--danger);
    border-color: var(--danger);
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #065f46;
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 600;
    animation: toastIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
