/* ============================================================
   KOMAK ERP — Design System
   ============================================================ */

:root {
    /* Colors — Surface */
    --color-bg: #f1f5f9;
    --color-surface: #ffffff;
    --color-surface-alt: #f8fafc;
    --color-surface-hover: #f1f5f9;

    /* Colors — Border */
    --color-border: #e2e8f0;
    --color-border-strong: #cbd5e1;
    --color-border-focus: #93c5fd;

    /* Colors — Primary (Blue) */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #eff6ff;

    /* Colors — Success (Green) */
    --color-success: #16a34a;
    --color-success-light: #f0fdf4;

    /* Colors — Danger (Red) */
    --color-danger: #dc2626;
    --color-danger-light: #fef2f2;

    /* Colors — Warning (Amber) */
    --color-warning: #d97706;
    --color-warning-light: #fffbeb;

    /* Colors — Purple */
    --color-purple: #7c3aed;
    --color-purple-light: #f5f3ff;

    /* Colors — Text */
    --color-text: #1e293b;
    --color-text-secondary: #475569;
    --color-text-muted: #94a3b8;

    /* Sidebar */
    --color-dark: #0f172a;
    --color-dark-surface: #1e293b;
    --color-dark-hover: #334155;
    --color-dark-border: #334155;
    --color-dark-text: #cbd5e1;
    --color-dark-text-active: #ffffff;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);

    /* Transitions */
    --transition-fast: 0.12s ease;
    --transition-base: 0.2s ease;
}

/* ============================================================
   BASE
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
}

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

.login-view {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.login-card {
    background: var(--color-surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 380px;
}

.login-logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    letter-spacing: -0.5px;
}

.login-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
    margin: 4px 0 28px;
}

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

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

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-error {
    background: var(--color-danger-light);
    color: var(--color-danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

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

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

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}
.btn-ghost:hover { background: var(--color-surface-hover); }

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

.btn-block { width: 100%; }

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

/* ============================================================
   APP SHELL
   ============================================================ */

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--color-dark);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 20px 16px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    border-bottom: 1px solid var(--color-dark-border);
}

.sidebar-logo {
    font-size: 20px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.3px;
}

.sidebar-tag {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-primary);
    background: rgba(37, 99, 235, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--color-dark-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

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

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

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

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--color-dark-border);
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.sidebar-user span:first-child {
    color: white;
    font-weight: 600;
    font-size: 13px;
}

.sidebar-role {
    font-size: 11px;
    color: var(--color-dark-text);
    text-transform: capitalize;
}

.btn-logout {
    width: 100%;
    padding: 7px;
    background: transparent;
    border: 1px solid var(--color-dark-border);
    border-radius: var(--radius-sm);
    color: var(--color-dark-text);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-logout:hover {
    background: var(--color-dark-hover);
    color: white;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 24px 32px;
    min-height: 100vh;
}

/* ============================================================
   PAGE HEADERS
   ============================================================ */

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

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--color-text);
}

.page-header-actions {
    display: flex;
    gap: 8px;
}

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

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

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

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

.card-body {
    padding: 20px;
}

/* ============================================================
   FILTERS BAR
   ============================================================ */

.filters-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-input {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition-fast);
}

.filter-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-input { width: 220px; }
.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-surface);
}

.filter-count {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-left: auto;
}


.filters-expanded {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.filter-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.filter-group .filter-input,
.filter-group .filter-select {
    width: 100%;
    box-sizing: border-box;
}

/* ============================================================
   FILES LIST
   ============================================================ */

.files-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: background var(--transition-fast);
}

.file-item:hover {
    background: var(--color-bg);
}

.file-link {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-primary);
    text-decoration: none;
}

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

.file-meta {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.btn-icon-sm {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

.file-item:hover .btn-icon-sm {
    opacity: 1;
}

.btn-icon-sm:hover {
    color: var(--color-danger);
    background: rgba(220, 38, 38, 0.1);
}

/* ============================================================
   DATA TABLE
   ============================================================ */

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

.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--color-border);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.data-table th:hover {
    color: var(--color-text);
}

.data-table th .sort-arrow {
    margin-left: 4px;
    opacity: 0.4;
}

.data-table th.sorted .sort-arrow {
    opacity: 1;
    color: var(--color-primary);
}

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

.data-table tr:hover {
    background: var(--color-surface-hover);
}

.data-table tr.clickable {
    cursor: pointer;
}

.data-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table .empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--color-text-muted);
    font-size: 14px;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-blue { background: var(--color-primary-light); color: var(--color-primary); }
.badge-green { background: var(--color-success-light); color: var(--color-success); }
.badge-red { background: var(--color-danger-light); color: var(--color-danger); }
.badge-yellow { background: var(--color-warning-light); color: var(--color-warning); }
.badge-purple { background: var(--color-purple-light); color: var(--color-purple); }
.badge-gray { background: #f1f5f9; color: var(--color-text-muted); }

.badge-solid {
    color: white;
}
.badge-solid.badge-blue { background: var(--color-primary); }
.badge-solid.badge-green { background: var(--color-success); }
.badge-solid.badge-red { background: var(--color-danger); }
.badge-solid.badge-yellow { background: var(--color-warning); }
.badge-solid.badge-purple { background: var(--color-purple); }

/* ============================================================
   DETAIL VIEW
   ============================================================ */

.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-header .btn-back {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.detail-header .btn-back:hover { background: var(--color-surface-hover); }

.detail-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    flex: 1;
}

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

.detail-grid.full-width {
    grid-template-columns: 1fr;
}

.detail-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.detail-field .value {
    font-size: 14px;
    color: var(--color-text);
}

.detail-field .value.large {
    font-size: 20px;
    font-weight: 700;
}

/* Status select */
.status-select {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    color: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}
.status-select option {
    background: white;
    color: var(--color-text);
    font-weight: 400;
}

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

/* ============================================================
   TOAST
   ============================================================ */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.25s ease;
    max-width: 360px;
}

.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
.toast-info { background: var(--color-primary); }

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

/* ============================================================
   LOADING
   ============================================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 10px;
}

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

/* ============================================================
   KANBAN BOARD
   ============================================================ */

.kanban-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 400px;
}

.kanban-column {
    min-width: 260px;
    max-width: 280px;
    flex-shrink: 0;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
}

.kanban-column-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.kanban-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kanban-count {
    background: var(--color-border);
    color: var(--color-text-muted);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.kanban-column-value {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.kanban-cards {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
    transition: background 0.15s;
}

.kanban-cards.drag-over {
    background: var(--color-primary-light);
}

.kanban-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.kanban-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.kanban-card.dragging {
    opacity: 0.5;
}

.kanban-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

.kanban-card-company {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.kanban-card-value {
    color: var(--color-success);
    font-weight: 600;
}

.kanban-card-assignee {
    color: var(--color-text-muted);
}

/* ============================================================
   DEAL DETAIL LAYOUT
   ============================================================ */

.deal-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

.deal-main { min-width: 0; }
.deal-sidebar { min-width: 0; }

.stage-select {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-surface);
    cursor: pointer;
}

/* ============================================================
   WALL / TIMELINE
   ============================================================ */

.wall-entry {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.wall-entry:last-child { border-bottom: none; }

.wall-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.15s;
}
.wall-entry:hover .wall-actions { opacity: 1; }

.wall-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1;
}
.wall-action-btn:hover { background: var(--color-bg-hover); color: var(--color-text); }

.wall-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

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

.wall-text {
    font-size: 13px;
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
}

.wall-meta {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* ============================================================
   TASKS
   ============================================================ */

.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

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

.task-item.completed .task-title {
    text-decoration: line-through;
    color: var(--color-text-muted);
}

.task-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex: 1;
}

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

.btn-icon-delete {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.task-item:hover .btn-icon-delete { opacity: 1; }
.btn-icon-delete:hover { color: var(--color-danger); background: var(--color-danger-bg, rgba(239,68,68,0.1)); }

.task-title {
    font-size: 13px;
    color: var(--color-text);
}

.task-due {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    margin-left: 8px;
}

.task-due.overdue {
    color: var(--color-danger);
    font-weight: 600;
}

/* ============================================================
   BTN ACTIVE STATE (view toggle)
   ============================================================ */

.btn-ghost.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* ============================================================
   PROCESS TABS
   ============================================================ */

.process-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0;
}

.process-tab {
    padding: 8px 18px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
}

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

.process-tab.active {
    color: var(--tab-color, var(--color-primary));
    border-bottom-color: var(--tab-color, var(--color-primary));
}

/* ============================================================
   CONFIGURATOR IFRAME
   ============================================================ */

.konfig-frame-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.konfig-frame {
    width: 100%;
    height: calc(100vh - 160px);
    border: none;
    display: block;
}

/* ============================================================
   OFFERS PANEL (in deal detail)
   ============================================================ */

.offer-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
    background: var(--color-surface-alt);
    transition: border-color var(--transition-fast);
}

.offer-card:hover {
    border-color: var(--color-primary);
}

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

.offer-card-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text);
}

.offer-card-subtitle {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.offer-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
    font-size: 12px;
    margin-bottom: 8px;
}

.offer-card-grid dt {
    color: var(--color-text-muted);
}

.offer-card-grid dd {
    color: var(--color-text);
    font-weight: 500;
    margin: 0;
    text-align: right;
}

.offer-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}

.offer-card-actions .btn {
    font-size: 11px;
    padding: 4px 8px;
}

.offer-financials {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}

.offer-fin-item {
    text-align: center;
}

.offer-fin-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
}

.offer-fin-value {
    font-size: 14px;
    font-weight: 600;
    margin-top: 2px;
}

.offer-fin-value.green { color: var(--color-success); }
.offer-fin-value.blue { color: var(--color-primary); }
.offer-fin-value.red { color: var(--color-danger); }

/* ============================================================
   RICH TEXT EDITOR
   ============================================================ */

.rich-editor-wrapper {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px 6px;
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
}

.rich-editor-toolbar button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.rich-editor-toolbar button:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.rich-editor-toolbar button.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.rich-editor-toolbar .separator {
    width: 1px;
    height: 20px;
    background: var(--color-border);
    margin: 4px 4px;
}

.rich-editor-content {
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    outline: none;
}

.rich-editor-content:focus {
    box-shadow: inset 0 0 0 1px var(--color-border-focus);
}

.rich-editor-content:empty::before {
    content: attr(data-placeholder);
    color: var(--color-text-muted);
}

.rich-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.15s;
    user-select: none;
}

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

.attach-btn:active {
    transform: scale(0.96);
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    border-top: 1px solid var(--color-border);
}

.attachment-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    font-size: 11px;
    color: var(--color-text-secondary);
}

.attachment-chip .remove-att {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: var(--color-text-muted);
}

.attachment-chip .remove-att:hover {
    color: var(--color-danger);
}

/* Wall entry attachments */
.wall-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.wall-attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 11px;
    color: var(--color-primary);
    text-decoration: none;
}

.wall-attachment-link:hover {
    background: var(--color-primary-light);
}

/* Wall entry with HTML content */
.wall-text-html {
    font-size: 13px;
    line-height: 1.5;
}

.wall-text-html b, .wall-text-html strong { font-weight: 600; }
.wall-text-html ul, .wall-text-html ol { margin: 4px 0; padding-left: 20px; }
.wall-text-html a { color: var(--color-primary); }

/* ============================================================
   WALL TABS (LiveSpace-style)
   ============================================================ */

.wall-tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 0;
}

.wall-tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.wall-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.wall-tab-icon {
    font-size: 15px;
}

.wall-tab-content {
    padding: 0;
}

/* Inline email compose (inside tab) */
.email-compose-inline {
    padding: 12px;
}

.email-compose-inline .form-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}

.email-compose-inline .form-row:last-of-type {
    border-bottom: none;
}

.email-compose-inline .form-row label {
    font-weight: 600;
    color: var(--color-text-muted);
    min-width: 50px;
    font-size: 12px;
}

.email-compose-inline .form-row input,
.email-compose-inline .form-row select {
    flex: 1;
    border: none;
    background: none;
    padding: 4px 0;
    font-size: 13px;
    outline: none;
    color: var(--color-text);
}

.email-compose-inline .form-row select {
    cursor: pointer;
}

.email-compose-inline .email-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 0 4px;
}

/* Email wall entry (LiveSpace-style) */
.wall-email-entry {
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.wall-email-entry:last-child { border-bottom: none; }

.wall-email-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.wall-email-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.wall-email-avatar.received {
    background: var(--color-success-light, #e8f5e9);
    color: var(--color-success, #2e7d32);
}

.wall-email-sender {
    flex: 1;
    min-width: 0;
}

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

.wall-email-sender-detail {
    font-size: 11px;
    color: var(--color-text-muted);
}

.wall-email-time {
    font-size: 11px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.wall-email-subject-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    padding-left: 42px;
}

.wall-email-direction-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.wall-email-subject {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text);
}

.wall-email-recipient {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-left: auto;
}

.wall-email-body-preview {
    padding-left: 42px;
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    max-height: 60px;
    overflow: hidden;
    position: relative;
}

.wall-email-body-preview.expanded {
    max-height: none;
}

.wall-email-body-full {
    padding-left: 42px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text);
    margin-top: 8px;
    padding: 12px;
    margin-left: 42px;
    background: var(--color-surface-alt);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    display: none;
}

.wall-email-body-full.visible {
    display: block;
}

.wall-email-actions {
    padding-left: 42px;
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.wall-email-actions .btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.wall-email-actions .btn-link:hover {
    background: var(--color-primary-light);
}

.wall-email-thread-badge {
    font-size: 11px;
    color: var(--color-text-muted);
    background: var(--color-surface-alt);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
}

/* ============================================================
   DASHBOARD TASKS
   ============================================================ */

.dash-task {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    align-items: flex-start;
}

.dash-task:last-child { border-bottom: none; }

.dash-task.overdue {
    background: var(--color-danger-light);
    margin: 0 -12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.dash-task-check {
    padding-top: 2px;
}

.dash-task-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.dash-task-body {
    flex: 1;
    min-width: 0;
}

.dash-task-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
}

.priority-flag {
    font-size: 12px;
    margin-right: 2px;
}

.dash-task-meta {
    display: flex;
    gap: 8px;
    margin-top: 2px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.dash-task-meta .text-danger {
    color: var(--color-danger);
    font-weight: 600;
}

/* ============================================================
   ADMIN TABS
   ============================================================ */

.admin-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--color-border);
}

.admin-tab {
    padding: 8px 20px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

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

.admin-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* ============================================================
   CONTACT PICKER (autocomplete)
   ============================================================ */

.contact-picker {
    position: relative;
}

.contact-picker-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.contact-picker-results.open {
    display: block;
}

.contact-picker-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid var(--color-border);
}

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

.contact-picker-item:hover {
    background: var(--color-surface-hover);
}

.contact-picker-item .cp-name {
    font-weight: 500;
}

.contact-picker-item .cp-company {
    font-size: 11px;
    color: var(--color-text-muted);
}

.contact-picker-item.cp-create {
    color: var(--color-primary);
    font-weight: 500;
}

.contact-picker-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.contact-picker-selected .cp-remove {
    margin-left: auto;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 16px;
    line-height: 1;
}

.contact-picker-selected .cp-remove:hover {
    color: var(--color-danger);
}

/* ============================================================
   CUSTOM FIELDS
   ============================================================ */

.fields-section {
    margin-bottom: 16px;
}

.fields-category {
    margin-bottom: 12px;
}

.fields-category-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}

.field-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.field-label {
    flex: 0 0 140px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-secondary);
    padding-top: 6px;
}

.field-value {
    flex: 1;
}

.field-value input,
.field-value select,
.field-value textarea {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 12px;
    background: var(--color-surface);
}

.field-value textarea {
    resize: vertical;
    min-height: 50px;
}

.field-value input:focus,
.field-value select:focus,
.field-value textarea:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.fields-save-bar {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* ============================================================
   MODERN SELECT & TEXTAREA
   ============================================================ */

select,
.modern-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: 9px 36px 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text);
    background-color: var(--color-surface);
    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='%2394a3b8' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

select:focus,
.modern-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select:hover,
.modern-select:hover {
    border-color: var(--color-border-strong);
}

.modern-textarea,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-surface);
    resize: vertical;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.modern-textarea:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ============================================================
   SEARCH PICKER (autocomplete for deals/contacts in tasks)
   ============================================================ */

.search-picker {
    position: relative;
}

.search-picker-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition-fast);
}

.search-picker-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-picker-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    max-height: 220px;
    overflow-y: auto;
    display: none;
    margin-top: 2px;
}

.search-picker-results.open {
    display: block;
}

.search-picker-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

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

.search-picker-item:hover {
    background: var(--color-surface-hover);
}

.search-picker-item .sp-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
}

.search-picker-item .sp-sub {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 1px;
}

.search-picker-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-primary-light);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-primary);
}

.search-picker-selected .sp-remove {
    margin-left: auto;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
}

.search-picker-selected .sp-remove:hover {
    color: var(--color-danger);
}

/* ============================================================
   ZADANIA MODULE
   ============================================================ */

.zadania-tab-group {
    display: inline-flex;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.zadania-tab {
    padding: 7px 16px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-right: 1px solid var(--color-border);
}

.zadania-tab:last-child {
    border-right: none;
}

.zadania-tab:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.zadania-tab.active {
    background: var(--color-primary);
    color: white;
}

.zadanie-done td {
    opacity: 0.5;
}

.zadanie-overdue td:not(:first-child) {
    background: var(--color-danger-light);
}

.zadanie-title {
    font-size: 13px;
    font-weight: 500;
}

.zadanie-desc {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-through {
    text-decoration: line-through;
}

.text-muted {
    color: var(--color-text-muted);
}

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

.font-semibold {
    font-weight: 600;
}

/* ============================================================
   TASK TYPE TAG
   ============================================================ */

.task-type-tag {
    display: inline-block;
    padding: 1px 7px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-left: 4px;
    vertical-align: middle;
}

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

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-logo { display: none; }
    .sidebar-tag { display: none; }
    .sidebar-user { display: none; }
    .nav-item span:not(.nav-icon) { display: none; }
    .nav-item { justify-content: center; padding: 12px; }
    .main-content { margin-left: 60px; padding: 16px; }
    .detail-grid { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .filter-input { width: 100%; }
    .deal-layout { grid-template-columns: 1fr; }
    .kanban-column { min-width: 220px; }
}
