:root {
    --erp-primary: #1e3a5f;
    --erp-primary-hover: #152a47;
    --erp-primary-light: #2d5a8e;
    --erp-primary-muted: rgba(30, 58, 95, 0.08);
    --erp-success: #16a34a;
    --erp-success-bg: #dcfce7;
    --erp-warning: #f59e0b;
    --erp-warning-bg: #fef3c7;
    --erp-danger: #ef4444;
    --erp-danger-bg: #fee2e2;
    --erp-info: #3b82f6;
    --erp-info-bg: #dbeafe;
    --erp-purple: #7c3aed;
    --erp-purple-bg: #ede9fe;
    --erp-coral: #f97316;

    --erp-bg: #f1f5f9;
    --erp-card: #ffffff;
    --erp-border: #e2e8f0;
    --erp-text: #0f172a;
    --erp-text-secondary: #64748b;
    --erp-text-muted: #94a3b8;

    --erp-sidebar-bg: #0f172a;
    --erp-sidebar-secondary: #1e293b;
    --erp-sidebar-active: #2563eb;
    --erp-sidebar-text: #ffffff;
    --erp-sidebar-muted: #94a3b8;
    --erp-sidebar-width: 260px;
    --erp-sidebar-collapsed: 72px;

    --erp-header-height: 64px;
    --erp-radius: 12px;
    --erp-radius-sm: 8px;
    --erp-radius-pill: 9999px;
    --erp-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
    --erp-shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.12);
    --erp-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    --erp-font: 'Inter', ui-sans-serif, system-ui, sans-serif;
    --erp-fs-xs: 0.75rem;
    --erp-fs-sm: 0.8125rem;
    --erp-fs-md: 0.875rem;
    --erp-fs-base: 0.9375rem;
    --erp-fs-lg: 1.0625rem;
    --erp-fs-xl: 1.25rem;
    --erp-fs-2xl: 1.375rem;
}

.dark {
    --erp-bg: #0b1220;
    --erp-card: #111827;
    --erp-border: #1f2937;
    --erp-text: #f9fafb;
    --erp-text-secondary: #9ca3af;
    --erp-text-muted: #6b7280;
    --erp-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
}

.erp-app {
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
    background: var(--erp-bg);
    color: var(--erp-text);
    min-height: 100vh;
}

.erp-card {
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
}

.erp-card--accent {
    position: relative;
    overflow: hidden;
}

.erp-card--accent::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--erp-primary) 0%, var(--erp-purple) 100%);
    border-radius: 0 var(--erp-radius) var(--erp-radius) 0;
}

.erp-glass {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--erp-border);
}

.dark .erp-glass {
    background: rgba(17, 24, 39, 0.92);
}

/* Buttons */
.erp-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: var(--erp-primary);
    border: 1px solid transparent;
    border-radius: var(--erp-radius-pill);
    transition: all var(--erp-transition);
    cursor: pointer;
    white-space: nowrap;
}

.erp-btn-primary:hover:not(:disabled) {
    background: var(--erp-primary-hover);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.25);
}

.erp-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.erp-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--erp-text-secondary);
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-pill);
    transition: all var(--erp-transition);
    cursor: pointer;
}

.erp-btn-secondary:hover:not(:disabled) {
    border-color: var(--erp-primary);
    color: var(--erp-primary);
    background: var(--erp-primary-muted);
}

.erp-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--erp-primary);
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-pill);
    transition: all var(--erp-transition);
    cursor: pointer;
}

.erp-btn-outline:hover {
    border-color: var(--erp-primary);
    background: var(--erp-primary-muted);
}

.erp-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: var(--erp-danger);
    border-radius: var(--erp-radius-pill);
    transition: all var(--erp-transition);
    cursor: pointer;
}

.erp-btn-danger:hover {
    filter: brightness(0.92);
}

.erp-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--erp-radius-sm);
    color: var(--erp-text-secondary);
    transition: all var(--erp-transition);
    cursor: pointer;
}

.erp-btn-icon:hover {
    background: var(--erp-primary-muted);
    color: var(--erp-primary);
}

.erp-btn-icon--danger:hover {
    background: var(--erp-danger-bg);
    color: var(--erp-danger);
}

/* Inputs */
.erp-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: var(--erp-text);
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    transition: border-color var(--erp-transition), box-shadow var(--erp-transition);
}

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

.erp-input:focus {
    outline: none;
    border-color: var(--erp-primary-light);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.erp-input:disabled {
    background: var(--erp-bg);
    cursor: not-allowed;
}

/* Form sections */
.erp-form-section {
    margin-bottom: 0.5rem;
}

.erp-form-section__heading {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--erp-border);
}

.erp-form-section__heading::before {
    content: '';
    width: 4px;
    min-height: 1.25rem;
    align-self: stretch;
    background: var(--erp-primary);
    border-radius: 2px;
    flex-shrink: 0;
}

.erp-form-section__title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--erp-primary);
    line-height: 1.3;
}

.erp-form-section__subtitle {
    margin-top: 0.125rem;
    font-size: 0.75rem;
    color: var(--erp-text-muted);
}

/* Tabs */
.erp-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--erp-border);
    overflow-x: auto;
}

.erp-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--erp-text-secondary);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all var(--erp-transition);
    white-space: nowrap;
}

.erp-tab:hover {
    color: var(--erp-primary);
}

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

.erp-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--erp-primary);
    background: var(--erp-primary-muted);
    border-radius: var(--erp-radius-pill);
}

/* Stats bar */
.erp-stats-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
}

.erp-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--erp-text-secondary);
    background: var(--erp-bg);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-pill);
}

.erp-stat-pill strong {
    font-weight: 700;
    color: var(--erp-text);
}

.erp-stat-pill--primary {
    color: #fff;
    background: var(--erp-primary);
    border-color: var(--erp-primary);
}

.erp-stat-pill--primary strong {
    color: #fff;
}

.erp-stat-pill--success {
    color: #166534;
    background: var(--erp-success-bg);
    border-color: #bbf7d0;
}

.erp-stat-pill--info {
    color: #1d4ed8;
    background: var(--erp-info-bg);
    border-color: #bfdbfe;
}

.erp-stat-pill--purple {
    color: #6d28d9;
    background: var(--erp-purple-bg);
    border-color: #ddd6fe;
}

.erp-stat-pill--danger {
    color: #fff;
    background: var(--erp-danger);
    border-color: var(--erp-danger);
}

/* Filter panel */
.erp-filter-panel {
    padding: 1.25rem;
}

.erp-filter-panel__title {
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--erp-primary-light);
}

.erp-filter-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.erp-filter-field__label {
    display: block;
    margin-bottom: 0.375rem;
    min-height: 1.125rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.125rem;
    color: var(--erp-text-secondary);
}

.erp-filter-field__control {
    display: flex;
    min-height: 2.625rem;
}

.erp-filter-field__control > .erp-input,
.erp-filter-field__control > select.erp-input {
    flex: 1 1 auto;
    min-width: 0;
}

.erp-filter-field__date-range {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.erp-filter-panel__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem 0.75rem;
    align-items: start;
}

@media (min-width: 768px) {
    .erp-filter-panel__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.erp-filter-panel .erp-input,
.erp-filter-panel select.erp-input {
    height: 2.625rem;
    min-height: 2.625rem;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.25;
    border-radius: var(--erp-radius-sm);
}

.erp-filter-panel__search-wrap {
    position: relative;
    width: 100%;
}

.erp-filter-panel__search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    z-index: 1;
    transform: translateY(-50%);
    color: var(--erp-text-muted);
    pointer-events: none;
}

.erp-filter-panel__input {
    width: 100%;
    padding-left: 2.5rem;
}

.erp-filter-panel__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--erp-border);
}

/* Table section */
.erp-table-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--erp-border);
}

.erp-table-section__title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--erp-primary-light);
}

.erp-table-section__count {
    font-weight: 500;
    color: var(--erp-text-muted);
}

/* Data table header */
.erp-table thead.erp-table-head--dark tr {
    background: var(--erp-primary);
}

.erp-table thead.erp-table-head--dark th {
    color: #fff;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.8125rem;
}

.erp-table thead.erp-table-head--dark th:hover {
    color: #fff;
}

/* Detail page header */
.erp-detail-header {
    margin-bottom: 1.5rem;
}

.erp-detail-header__main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--erp-border);
}

.erp-detail-header__title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--erp-primary);
    line-height: 1.2;
}

.erp-detail-header__meta {
    margin-top: 0.375rem;
    font-size: 0.875rem;
    color: var(--erp-text-secondary);
}

/* Back link */
.erp-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.4375rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--erp-text-secondary);
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-pill);
    transition: all var(--erp-transition);
    text-decoration: none;
}

.erp-back-link:hover {
    border-color: var(--erp-primary);
    color: var(--erp-primary);
    background: var(--erp-primary-muted);
}

/* Modal */
.erp-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--erp-border);
}

.erp-modal-header__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
    background: var(--erp-primary);
    color: #fff;
    border-radius: var(--erp-radius-sm);
}

.erp-modal-header__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--erp-primary);
}

.erp-modal-header__subtitle {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--erp-text-secondary);
}

.erp-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--erp-border);
    background: var(--erp-bg);
}

/* Badges */
.erp-code-badge {
    display: inline-flex;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--erp-text);
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-pill);
}

.erp-value-positive {
    font-weight: 700;
    color: var(--erp-success);
}

.erp-overdue-badge {
    display: inline-flex;
    margin-top: 0.25rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #c2410c;
    background: #ffedd5;
    border-radius: var(--erp-radius-pill);
}

/* Status badges */
.erp-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: capitalize;
    border-radius: var(--erp-radius-pill);
    line-height: 1.4;
}

.erp-status-badge--new { background: #60a5fa; color: #fff; }
.erp-status-badge--contacted { background: var(--erp-primary); color: #fff; }
.erp-status-badge--qualified { background: #7c3aed; color: #fff; }
.erp-status-badge--proposal { background: #8b5cf6; color: #fff; }
.erp-status-badge--negotiation { background: #f59e0b; color: #fff; }
.erp-status-badge--won { background: var(--erp-success); color: #fff; }
.erp-status-badge--lost { background: var(--erp-danger); color: #fff; }
.erp-status-badge--pending { background: #fbbf24; color: #78350f; }
.erp-status-badge--completed { background: var(--erp-success); color: #fff; }
.erp-status-badge--cancelled { background: #94a3b8; color: #fff; }
.erp-status-badge--overdue { background: #ffedd5; color: #c2410c; }
.erp-status-badge--active { background: var(--erp-success); color: #fff; }
.erp-status-badge--inactive { background: #e2e8f0; color: #64748b; }
.erp-status-badge--prospect { background: #38bdf8; color: #fff; }
.erp-status-badge--vip { background: #f59e0b; color: #fff; }
.erp-status-badge--draft { background: #94a3b8; color: #fff; }
.erp-status-badge--qualification { background: var(--erp-primary); color: #fff; }
.erp-status-badge--default { background: #e2e8f0; color: #475569; }

/* Priority badges */
.erp-priority-badge {
    display: inline-flex;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: capitalize;
    border-radius: var(--erp-radius-pill);
    color: #fff;
}

.erp-priority-badge--low { background: #64748b; }
.erp-priority-badge--medium { background: #3b82f6; }
.erp-priority-badge--high { background: #f59e0b; }
.erp-priority-badge--urgent { background: #ef4444; }

/* Avatar */
.erp-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    color: #fff;
    background: var(--erp-primary);
    border-radius: 50%;
}

.erp-avatar--sm { width: 2rem; height: 2rem; font-size: 0.75rem; }
.erp-avatar--md { width: 2.5rem; height: 2.5rem; font-size: 0.875rem; }
.erp-avatar--lg { width: 3rem; height: 3rem; font-size: 1rem; }

/* Section header */
.erp-section-header__title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--erp-primary-light);
}

.erp-section-header__title::before {
    content: '';
    width: 4px;
    height: 1.125rem;
    background: var(--erp-primary);
    border-radius: 2px;
}

/* Sidebar badge */
.erp-nav-badge {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: rgba(37, 99, 235, 0.8);
    border-radius: var(--erp-radius-pill);
}

/* Pagination */
.erp-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--erp-border);
    background: var(--erp-bg);
}

.erp-pagination__info {
    font-size: 0.8125rem;
    color: var(--erp-text-secondary);
}

.erp-pagination__info strong {
    color: var(--erp-text);
    font-weight: 600;
}

.erp-pagination__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.erp-pagination__per-page {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.erp-pagination__per-page-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--erp-text-secondary);
}

.erp-pagination__select {
    width: auto;
    min-width: 4.5rem;
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
}

.erp-pagination__pages {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.erp-pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--erp-text-secondary);
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    transition: all var(--erp-transition);
    cursor: pointer;
}

.erp-pagination__btn:hover:not(:disabled):not(.erp-pagination__btn--gap) {
    border-color: var(--erp-primary);
    color: var(--erp-primary);
    background: var(--erp-primary-muted);
}

.erp-pagination__btn--active {
    color: #fff;
    background: var(--erp-primary);
    border-color: var(--erp-primary);
}

.erp-pagination__btn--gap {
    cursor: default;
    border-color: transparent;
    background: transparent;
}

.erp-pagination__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.erp-pagination__single-page {
    font-size: 0.75rem;
    color: var(--erp-text-muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.erp-skeleton {
    background: linear-gradient(90deg, var(--erp-border) 25%, transparent 50%, var(--erp-border) 75%);
    background-size: 200% 100%;
    animation: erp-shimmer 1.5s infinite;
    border-radius: var(--erp-radius-sm);
}

@keyframes erp-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.erp-fade-enter-active,
.erp-fade-leave-active {
    transition: opacity 0.2s ease;
}

.erp-fade-enter-from,
.erp-fade-leave-to {
    opacity: 0;
}

.erp-slide-enter-active,
.erp-slide-leave-active {
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.erp-slide-enter-from,
.erp-slide-leave-to {
    transform: translateY(8px);
    opacity: 0;
}

@media (max-width: 1024px) {
    :root {
        --erp-sidebar-width: 280px;
    }
}

#main-content .bg-white.border.border-slate-200 {
    background: var(--erp-card);
    border-color: var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
}

#main-content h2.text-xl.font-semibold {
    color: var(--erp-text);
    font-weight: 600;
}

#main-content .text-slate-500 {
    color: var(--erp-text-secondary);
}

#main-content .border.rounded-md,
#main-content input.border,
#main-content select.border,
#main-content textarea.border {
    border-color: var(--erp-border);
    border-radius: var(--erp-radius-sm);
    color: var(--erp-text);
    background: var(--erp-card);
}

#main-content .bg-slate-900.text-white {
    background: var(--erp-primary);
}

#main-content .bg-slate-900.text-white:hover,
#main-content .hover\:bg-slate-800:hover {
    background: var(--erp-primary-hover);
}

#main-content .bg-emerald-600 {
    background: var(--erp-success);
}

#main-content .hover\:bg-emerald-700:hover {
    filter: brightness(0.95);
}

.erp-company-logo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 5rem;
    height: 5rem;
    overflow: hidden;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-bg);
}

/* Sales document (invoice / quotation) */
.erp-document-page__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.erp-sales-document {
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
    overflow: hidden;
}

.erp-sales-document__loading {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--erp-text-secondary);
    font-size: 0.875rem;
}

.erp-sales-document__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--erp-border);
    background: linear-gradient(135deg, var(--erp-primary-muted) 0%, transparent 60%);
}

.erp-sales-document__brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.erp-sales-document__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    overflow: hidden;
    border-radius: var(--erp-radius-sm);
    background: var(--erp-primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.erp-sales-document__logo img {
    background: #fff;
}

.erp-sales-document__company-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--erp-text);
}

.erp-sales-document__company-meta {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--erp-text-secondary);
}

.erp-sales-document__title-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    text-align: right;
}

.erp-sales-document__title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--erp-primary);
}

.erp-sales-document__parties {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--erp-border);
}

.erp-sales-document__party-label {
    margin-bottom: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--erp-text-muted);
}

.erp-sales-document__party-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--erp-text);
}

.erp-sales-document__party-code,
.erp-sales-document__party-contact,
.erp-sales-document__party-lines {
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--erp-text-secondary);
    white-space: pre-line;
}

.erp-sales-document__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 1rem;
    padding: 1.25rem 2rem;
    background: var(--erp-bg);
    border-bottom: 1px solid var(--erp-border);
}

.erp-sales-document__meta-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--erp-text-muted);
}

.erp-sales-document__meta-value {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--erp-text);
}

.erp-sales-document__table-wrap {
    overflow-x: auto;
}

.erp-sales-document__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.erp-sales-document__table thead {
    background: var(--erp-primary);
    color: #fff;
}

.erp-sales-document__table th {
    padding: 0.75rem 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: left;
}

.erp-sales-document__table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--erp-border);
    vertical-align: top;
    color: var(--erp-text);
}

.erp-sales-document__table tbody tr:nth-child(even) {
    background: var(--erp-bg);
}

.erp-sales-document__line-title {
    display: block;
    font-weight: 500;
}

.erp-sales-document__line-sub {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: var(--erp-text-muted);
}

.erp-sales-document__empty {
    padding: 2rem 1rem !important;
    text-align: center;
    color: var(--erp-text-muted);
}

.erp-sales-document__footer {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(16rem, 0.8fr);
    gap: 2rem;
    padding: 1.5rem 2rem 2rem;
}

.erp-sales-document__notes h3 {
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--erp-text-muted);
}

.erp-sales-document__notes p {
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--erp-text-secondary);
    white-space: pre-line;
}

.erp-sales-document__totals {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    overflow: hidden;
    align-self: start;
}

.erp-sales-document__total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    color: var(--erp-text-secondary);
    border-bottom: 1px solid var(--erp-border);
}

.erp-sales-document__total-row:last-child {
    border-bottom: 0;
}

.erp-sales-document__total-row--grand {
    background: var(--erp-primary-muted);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--erp-text);
}

.erp-sales-document__total-row--due {
    background: var(--erp-warning-bg);
    font-weight: 700;
    color: var(--erp-text);
}

.erp-sales-document__actions {
    padding: 0 2rem 1.5rem;
}

@media (max-width: 768px) {
    .erp-sales-document__header,
    .erp-sales-document__parties,
    .erp-sales-document__meta,
    .erp-sales-document__footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .erp-sales-document__parties,
    .erp-sales-document__footer {
        grid-template-columns: 1fr;
    }

    .erp-sales-document__title-block {
        align-items: flex-start;
        text-align: left;
    }
}

@media print {
    body * {
        visibility: hidden;
    }

    .erp-sales-document,
    .erp-sales-document * {
        visibility: visible;
    }

    .erp-sales-document {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border: 0;
        box-shadow: none;
        border-radius: 0;
    }

    .no-print {
        display: none !important;
    }

    .erp-app aside,
    .erp-app header,
    .erp-modal-header,
    .erp-modal-footer {
        display: none !important;
    }
}
