/* CV Service CRM - shared desktop styles (header + sidebar) */

:root {
            --crm-primary: #2563eb;
            --crm-primary-dark: #1d4ed8;
            --crm-bg: #f3f4f6;
            --crm-card: #ffffff;
            --crm-border: #e5e7eb;
            --crm-text: #111827;
            --crm-muted: #6b7280;
            --crm-danger: #dc2626;
            --crm-success: #16a34a;
            --crm-warning: #ca8a04;
            --crm-radius: 12px;
            --crm-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            background: var(--crm-bg);
            color: var(--crm-text);
            font-family: Arial, Helvetica, sans-serif;
            font-size: 14px;
            line-height: 1.45;
        }

        a {
            color: var(--crm-primary);
        }

        .topbar {
            background: #111827;
            color: #ffffff;
            border-bottom: 1px solid #0f172a;
            position: sticky;
            top: 0;
            z-index: 1000;
        }

        .topbar-inner {
            max-width: 1500px;
            margin: 0 auto;
            padding: 0 18px 0 118px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
            min-height: 62px;
        }

        .brand {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 10px;
            flex: 0 1 auto;
            max-width: min(340px, 42vw);
            text-decoration: none;
            color: #ffffff;
            min-width: 0;
        }

        .brand-mark {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            flex-shrink: 0;
            display: block;
        }

        .brand-text {
            display: flex;
            flex-direction: column;
            gap: 2px;
            min-width: 0;
        }

        .brand-text--inline {
            flex-direction: row;
            align-items: baseline;
            flex-wrap: nowrap;
            gap: 0.45rem;
        }

        .brand-title {
            font-size: 18px;
            font-weight: 800;
            letter-spacing: 0.01em;
            white-space: nowrap;
        }

        .brand-subtitle {
            font-size: 12px;
            color: #cbd5e1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-weight: 500;
        }

        .brand-text--inline .brand-subtitle {
            opacity: 0.85;
        }

        .main-nav {
            display: flex;
            align-items: center;
            gap: 2px;
            flex: 1 1 auto;
            min-width: 0;
            flex-wrap: wrap;
            justify-content: flex-end;
        }

        .nav-link,
        .dropdown-button {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            color: #e5e7eb;
            text-decoration: none;
            padding: 10px 11px;
            border-radius: 9px;
            font-size: 14px;
            font-weight: 600;
            white-space: nowrap;
            border: 0;
            background: transparent;
            cursor: pointer;
            font-family: inherit;
        }

        .nav-link:hover,
        .dropdown-button:hover,
        .nav-link.active,
        .dropdown-button.active {
            background: rgba(255, 255, 255, 0.12);
            color: #ffffff;
        }

        .dropdown {
            position: relative;
        }

        .dropdown-menu {
            display: none;
            position: absolute;
            right: 0;
            top: 100%;
            min-width: 230px;
            background: #ffffff;
            color: #111827;
            border: 1px solid var(--crm-border);
            border-radius: 12px;
            box-shadow: 0 14px 35px rgba(15, 23, 42, 0.18);
            padding: 8px;
            z-index: 2000;
        }

        .dropdown:hover .dropdown-menu,
        .dropdown:focus-within .dropdown-menu {
            display: block;
        }

        .dropdown-title {
            padding: 8px 10px 6px 10px;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--crm-muted);
            font-weight: 800;
        }

        .dropdown-link {
            display: block;
            padding: 9px 10px;
            border-radius: 8px;
            color: #111827;
            text-decoration: none;
            font-weight: 600;
        }

        .dropdown-link:hover,
        .dropdown-link.active {
            background: #eff6ff;
            color: #1d4ed8;
        }

        .dropdown-divider {
            height: 1px;
            background: var(--crm-border);
            margin: 7px 4px;
        }

        .page-shell {
            max-width: 1500px;
            margin: 0 auto;
            padding: 22px 18px 38px 18px;
        }

        .page-header {
            margin-bottom: 18px;
        }

        .page-header h1,
        h1 {
            margin: 0 0 14px 0;
            font-size: 28px;
            line-height: 1.2;
            color: #111827;
        }

        h2 {
            margin: 0 0 14px 0;
            font-size: 20px;
            color: #111827;
        }

        h3 {
            margin: 0 0 10px 0;
            font-size: 16px;
            color: #111827;
        }

        .card {
            background: var(--crm-card);
            border: 1px solid var(--crm-border);
            border-radius: var(--crm-radius);
            padding: 18px;
            margin-bottom: 18px;
            box-shadow: var(--crm-shadow);
        }

        .quick-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
        }

        .btn {
            display: inline-block;
            background: var(--crm-primary);
            color: #ffffff !important;
            padding: 9px 13px;
            border-radius: 8px;
            text-decoration: none;
            font-weight: 700;
            border: 0;
            cursor: pointer;
            font-size: 14px;
            line-height: 1.2;
            font-family: inherit;
        }

        .btn:hover {
            background: var(--crm-primary-dark);
            color: #ffffff !important;
        }

        .btn-secondary {
            background: #6b7280;
        }

        .btn-secondary:hover {
            background: #4b5563;
        }

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

        .btn-success:hover {
            background: #15803d;
        }

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

        .btn-danger:hover {
            background: #b91c1c;
        }

        .btn-warning {
            background: var(--crm-warning);
        }

        .btn-warning:hover {
            background: #a16207;
        }

        .btn-sm {
            padding: 6px 10px;
            font-size: 12px;
            border-radius: 7px;
        }

        .btn.disabled,
        .btn[aria-disabled="true"] {
            opacity: 0.45;
            pointer-events: none;
            cursor: default;
        }

        .table-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            align-items: center;
        }

        .filter-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
            margin-top: 8px;
        }

        .list-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
        }

        .list-meta-count {
            color: var(--crm-muted);
            font-size: 13px;
            font-weight: 600;
        }

        .pagination {
            display: inline-flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
        }

        .pagination-page {
            font-size: 13px;
            font-weight: 700;
            color: #374151;
        }

        .search-inline {
            display: grid;
            grid-template-columns: 1fr auto auto;
            gap: 10px;
            align-items: end;
        }

        .search-inline label {
            margin-top: 0;
        }

        .empty-state {
            text-align: center;
            padding: 28px 16px;
            color: var(--crm-muted);
        }

        .empty-state strong {
            display: block;
            color: #111827;
            font-size: 16px;
            margin-bottom: 6px;
        }

        .badge {
            display: inline-block;
            background: #e5e7eb;
            color: #374151;
            padding: 4px 8px;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 800;
            line-height: 1.2;
        }

        .error {
            background: #fee2e2;
            color: #991b1b;
            border: 1px solid #fecaca;
            padding: 12px 14px;
            border-radius: 10px;
            margin-bottom: 14px;
        }

        .success {
            background: #dcfce7;
            color: #166534;
            border: 1px solid #bbf7d0;
            padding: 12px 14px;
            border-radius: 10px;
            margin-bottom: 14px;
        }

        .warning {
            background: #fef9c3;
            color: #854d0e;
            border: 1px solid #fde68a;
            padding: 12px 14px;
            border-radius: 10px;
            margin-bottom: 14px;
        }

        .muted,
        .muted-small {
            color: var(--crm-muted);
        }

        .muted-small {
            font-size: 12px;
        }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 18px;
        }

        label {
            display: block;
            font-weight: 700;
            margin: 12px 0 6px 0;
            color: #374151;
        }

        input,
        select,
        textarea {
            width: 100%;
            border: 1px solid #d1d5db;
            border-radius: 8px;
            padding: 9px 10px;
            font-size: 14px;
            font-family: inherit;
            background: #ffffff;
            color: #111827;
        }

        textarea {
            resize: vertical;
            min-height: 90px;
        }

        input:focus,
        select:focus,
        textarea:focus {
            outline: none;
            border-color: var(--crm-primary);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
        }

        .table-responsive {
            width: 100%;
            overflow-x: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            background: #ffffff;
        }

        th,
        td {
            padding: 10px;
            border-bottom: 1px solid var(--crm-border);
            vertical-align: top;
            text-align: left;
        }

        th {
            background: #f9fafb;
            color: #374151;
            font-weight: 800;
        }

        tr:hover td {
            background: #fafafa;
        }

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

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

        .crm-footer {
            max-width: 1500px;
            margin: 0 auto;
            padding: 18px;
            color: var(--crm-muted);
            font-size: 12px;
            text-align: center;
        }

        @media (max-width: 1050px) {
            .topbar-inner {
                align-items: flex-start;
                flex-direction: column;
                padding-top: 12px;
                padding-bottom: 12px;
            }

            .main-nav {
                justify-content: flex-start;
            }

            .dropdown-menu {
                left: 0;
                right: auto;
            }
        }

        @media (max-width: 700px) {
            .page-shell {
                padding: 16px 12px 28px 12px;
            }

            .form-grid {
                grid-template-columns: 1fr;
                gap: 0;
            }

            .search-inline {
                grid-template-columns: 1fr;
            }

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

            .main-nav {
                display: grid;
                grid-template-columns: 1fr 1fr;
                width: 100%;
            }

            .nav-link,
            .dropdown-button {
                width: 100%;
                justify-content: center;
            }

            .dropdown-menu {
                position: static;
                width: 100%;
                margin-top: 4px;
                box-shadow: none;
            }

            .dropdown:hover .dropdown-menu,
            .dropdown:focus-within .dropdown-menu {
                display: block;
            }

            .card {
                padding: 14px;
            }
        }

        @media print {
            .topbar,
            .crm-footer,
            .quick-actions,
            .btn {
                display: none !important;
            }

            body {
                background: #ffffff;
            }

            .page-shell {
                max-width: none;
                padding: 0;
            }

            .card {
                box-shadow: none;
                border-color: #d1d5db;
            }
        }

/* ---- sidebar ---- */

.crm-sidebar-toggle {
        position: fixed;
        top: 14px;
        left: 14px;
        z-index: 1002;
        background: #111827;
        color: #fff;
        border: 1px solid rgba(255,255,255,.18);
        border-radius: 10px;
        padding: 8px 12px;
        font-weight: 800;
        font-size: 13px;
        box-shadow: 0 2px 10px rgba(0,0,0,.25);
        cursor: pointer;
    }

    .crm-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 1000;
    }

    body.crm-sidebar-open .crm-sidebar-overlay {
        display: block;
    }

    .crm-sidebar {
        position: fixed;
        top: 0;
        left: -295px;
        width: 280px;
        height: 100vh;
        background: #111827;
        color: #fff;
        z-index: 1001;
        overflow-y: auto;
        box-shadow: 2px 0 14px rgba(0,0,0,.28);
        transition: left .2s ease;
    }

    body.crm-sidebar-open .crm-sidebar {
        left: 0;
    }

    .crm-sidebar-inner {
        width: 100%;
        padding-bottom: 20px;
    }

    .crm-sidebar-brand {
        padding: 18px 16px;
        border-bottom: 1px solid rgba(255,255,255,.10);
    }

    .crm-sidebar-brand-row {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .crm-sidebar-brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        flex-shrink: 0;
        display: block;
    }

    .crm-sidebar-brand-text {
        min-width: 0;
    }

    .crm-sidebar-brand-text--inline {
        display: flex;
        flex-direction: row;
        align-items: baseline;
        flex-wrap: wrap;
        gap: 0.4rem 0.55rem;
    }

    .crm-sidebar-brand-title {
        font-size: 18px;
        font-weight: 800;
        line-height: 1.2;
        white-space: nowrap;
    }

    .crm-sidebar-brand-subtitle {
        margin-top: 0;
        color: #9ca3af;
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
    }

    .crm-sidebar-brand-text:not(.crm-sidebar-brand-text--inline) .crm-sidebar-brand-subtitle {
        margin-top: 5px;
    }

    .crm-sidebar-close {
        display: inline-block;
        margin-top: 12px;
        background: rgba(255,255,255,.10);
        color: #fff;
        border: 0;
        border-radius: 8px;
        padding: 8px 10px;
        cursor: pointer;
        font-weight: 700;
    }

    .crm-sidebar-section {
        padding: 10px 10px 2px;
    }

    .crm-sidebar-section-title {
        padding: 10px 8px 6px;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .08em;
        color: #9ca3af;
        font-weight: 700;
    }

    .crm-sidebar-link {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 10px;
        border-radius: 10px;
        color: #e5e7eb;
        text-decoration: none;
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 3px;
        transition: background .15s ease, color .15s ease, transform .15s ease;
    }

    .crm-sidebar-link:hover {
        background: rgba(255,255,255,.10);
        color: #fff;
        transform: translateX(2px);
    }

    .crm-sidebar-link.active {
        background: #1f6feb;
        color: #fff;
    }

    .crm-sidebar-icon {
        width: 24px;
        height: 24px;
        min-width: 24px;
        border-radius: 8px;
        background: rgba(255,255,255,.10);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
        font-weight: 800;
    }

    .crm-sidebar-link.active .crm-sidebar-icon {
        background: rgba(255,255,255,.18);
    }

    .crm-sidebar-footer {
        padding: 14px 16px 18px;
        border-top: 1px solid rgba(255,255,255,.10);
        color: #9ca3af;
        font-size: 12px;
        margin-top: 12px;
        word-break: break-word;
    }

    .crm-sidebar-footer strong {
        color: #e5e7eb;
    }

    @media print {
        .crm-sidebar-toggle,
        .crm-sidebar,
        .crm-sidebar-overlay {
            display: none !important;
        }
    }
