/* Production Tracking System - Clean Professional RTL Stylesheet */
:root {
    --font-sans: 'El Messiri', 'Cairo', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    
    --teal-brand: #007791;
    --teal-light: #e6f4f6;
    
    --success: #10b981;
    --success-light: #d1fae5;
    --success-text: #065f46;
    
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-text: #92400e;
    
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --danger-text: #991b1b;
    
    --purple: #8b5cf6;
    --purple-light: #ede9fe;
    --purple-text: #5b21b6;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    direction: rtl;
    text-align: right;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
    font-family: var(--font-sans);
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #0b0f17;
    color: #ffffff;
    border-left: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid #1e293b;
    margin-bottom: 18px;
}

.logo-box {
    width: 36px;
    height: 36px;
    background: #007791;
    color: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
}

.logo-title {
    font-weight: 700;
    font-size: 16px;
    color: #ffffff;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin: 14px 10px 8px 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: #e2e8f0;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background-color: #1e293b;
    color: #ffffff;
}

.nav-item.active {
    background-color: #007791;
    color: #ffffff;
    font-weight: 700;
}

.nav-item.nav-live {
    background-color: #f0fdf4;
    color: #15803d;
    border: 1px dashed #86efac;
    margin-top: 6px;
}

.live-dot-badge {
    background: #22c55e;
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: auto;
}

.nav-icon {
    width: 17px;
    height: 17px;
    stroke-width: 2;
    flex-shrink: 0;
}

.sidebar-footer-note {
    margin-top: auto;
    padding: 12px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

.sidebar-role-selector {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

.sidebar-role-selector label {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 5px;
}

.sidebar-role-selector select {
    width: 100%;
    padding: 7px 8px;
    font-size: 12px;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    cursor: pointer;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
}

/* Top App Bar */
.top-bar {
    height: 60px;
    background: #0b0f17;
    color: #ffffff;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
}

.breadcrumb-item {
    color: #cbd5e1;
}

.breadcrumb-sep {
    color: #64748b;
}

.breadcrumb-active {
    color: #ffffff;
    font-weight: 600;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.action-buttons-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar .btn-outline {
    background: #1e293b;
    color: #ffffff;
    border-color: #334155;
}

.top-bar .btn-outline:hover {
    background: #334155;
    color: #ffffff;
}

.user-dropdown-container {
    position: relative;
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    background: #1e293b;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.user-profile-badge:hover {
    background: #334155;
    border-color: #475569;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    color: #ffffff;
}

.user-role-sub {
    font-size: 10.5px;
    color: #cbd5e1;
}

.chevron-user-icon {
    width: 14px;
    height: 14px;
    color: #cbd5e1;
    transition: transform 0.2s ease;
}

.user-profile-badge.active .chevron-user-icon {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 320px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    padding: 8px;
    z-index: 100;
}

.user-dropdown-menu.active {
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: dropdownFade 0.15s ease-out;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-header-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    padding: 6px 8px 4px 8px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.user-dropdown-item:hover {
    background-color: #f8fafc;
}

.user-dropdown-item.active {
    background-color: #f0fdfa;
    border-right: 3px solid #0d9488;
}

.dropdown-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: #f1f5f9;
    flex-shrink: 0;
}

.dropdown-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dropdown-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.dropdown-desc {
    font-size: 10.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #334155;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Page Header */
.page-header {
    padding: 24px 32px 14px 32px;
}

.header-split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.role-permission-banner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.user-dept-plan-counter {
    margin-top: 2px;
}

.dept-counter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.dept-counter-badge strong {
    font-size: 12px;
    font-weight: 800;
    color: #0f172a;
}

.dept-counter-badge.count-pending {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.dept-counter-badge.count-pending strong {
    color: #1e40af;
}

.dept-counter-badge.count-zero {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}

.dept-counter-badge.count-admin {
    background: #f5f3ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}

.role-badge-pill {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.page-subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* View Panels */
.view-panel {
    display: none;
    padding: 0 32px 32px 32px;
}

.view-panel.active {
    display: block;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: #0284c7;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #0369a1;
}

.btn-secondary {
    background-color: #ffffff;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: #f8fafc;
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
}

.btn-icon {
    width: 15px;
    height: 15px;
}

/* Top 4 KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: all 0.15s ease;
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.kpi-title {
    font-size: 13.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    margin: 8px 0 4px 0;
}

.kpi-subtext {
    font-size: 12px;
    color: var(--text-muted);
}

.text-red {
    color: #dc2626 !important;
}

.text-green {
    color: #16a34a !important;
}

.text-amber {
    color: #d97706 !important;
}

.text-blue {
    color: #0284c7 !important;
}

/* Filters Card */
.filter-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}

.filter-row {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 160px;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-select {
    padding: 8px 12px;
    font-family: inherit;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}

.filter-select:focus {
    border-color: var(--primary);
}

.filter-search-group {
    flex: 1;
    min-width: 220px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    right: 10px;
    width: 16px;
    height: 16px;
    color: var(--text-dim);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 8px 34px 8px 12px;
    font-family: inherit;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
}

.filter-reset-group {
    min-width: auto;
}

/* Plans Table Card */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-header-bar {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
}

.table-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.table-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.table-badge-counter {
    background: #f1f5f9;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.table-responsive {
    overflow-x: auto;
}

.plans-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: right;
}

.plans-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12.5px;
    white-space: nowrap;
}

.plans-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    vertical-align: middle;
}

.plans-table tr:hover td {
    background-color: #f8fafc;
    cursor: pointer;
}

.plans-table tr.selected td {
    background-color: #f0fdfa;
    border-color: #99f6e4;
}

.plans-table tr[id^="rdHistoryRow_"]:hover td,
.plans-table tr[id^="qaHistoryRow_"]:hover td {
    background-color: #f8fafc !important;
    cursor: default !important;
}

/* Table Specific Cell Styles */
.plan-company-product {
    display: flex;
    flex-direction: column;
}

.plan-company-name {
    font-weight: 600;
    color: var(--text-primary);
}

.plan-formula-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.plan-batch-code {
    font-family: monospace;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 13.5px;
}

/* Progress bar inside table cell */
.table-progress-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 120px;
}

.table-progress-bg {
    flex: 1;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.table-progress-fill {
    height: 100%;
    background-color: var(--primary);
    border-radius: 4px;
}

.table-progress-pct {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 32px;
    text-align: left;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-warning {
    background-color: var(--warning-light);
    color: var(--warning-text);
}

.badge-info {
    background-color: var(--primary-light);
    color: var(--primary);
}

.badge-cyan {
    background-color: #e0f2fe;
    color: #0284c7;
}

.badge-purple {
    background-color: var(--purple-light);
    color: var(--purple-text);
}

.badge-danger, .badge-red {
    background-color: var(--danger-light);
    color: var(--danger-text);
    border: 1px solid rgba(239, 68, 68, 0.28);
}
.badge-success, .badge-green {
    background-color: var(--success-light);
    color: var(--success-text);
    border: 1px solid rgba(16, 185, 129, 0.28);
}

/* Lower Section Grid (Matching Screenshot 2) */
.dashboard-details-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 22px;
}

.detail-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.detail-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.detail-card-subtitle {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Stage Distribution Bar List */
.stage-dist-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stage-dist-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stage-dist-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
}

.stage-dist-name {
    color: var(--text-secondary);
    font-weight: 600;
}

.stage-dist-count {
    color: var(--text-muted);
    font-weight: 500;
}

.stage-dist-bar-bg {
    height: 8px;
    background-color: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
}

.stage-dist-bar-fill {
    height: 100%;
    background-color: #0284c7;
    border-radius: 6px;
}

/* Selected Plan Detailed Card */
.selected-plan-headline {
    font-size: 14px;
    font-weight: 700;
    color: #0369a1;
    margin-top: 2px;
}

.header-right-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 4-Grid Spec Metadata */
.plan-spec-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.plan-spec-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.plan-spec-label {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.plan-spec-value {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
}

/* General Progress Bar Section */
.general-progress-section {
    margin-bottom: 24px;
}

.general-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.general-progress-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.general-progress-pct {
    font-size: 14px;
    font-weight: 800;
    color: var(--primary);
}

.progress-bar-lg {
    height: 10px;
    background-color: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar-fill-lg {
    height: 100%;
    background-color: #0284c7;
    border-radius: 6px;
    transition: width 0.4s ease;
}

/* 6-Stage Stepper Component */
.workflow-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

.step-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 2;
}

.step-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #eff6ff;
    color: #1d4ed8;
    border: 2px solid #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.25s ease;
}

.step-label {
    font-size: 11px;
    font-weight: 600;
    color: #2563eb;
    white-space: nowrap;
    transition: color 0.25s ease;
}

/* 1. الأخضر: خرجت الخطة منه بنجاح وانتهى دوره */
.step-node.completed .step-circle {
    background: #16a34a !important;
    border-color: #15803d !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(22, 163, 74, 0.25) !important;
}
.step-node.completed .step-label {
    color: #15803d !important;
    font-weight: 700 !important;
}

/* 2. الأحمر: الخطة عنده حالياً ومتوقفة لم تتحرك بعد */
.step-node.active .step-circle {
    background: #ef4444 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 4px #fee2e2 !important;
    animation: pulseRedActive 2s infinite ease-in-out;
}
.step-node.active .step-label {
    color: #dc2626 !important;
    font-weight: 800 !important;
}

@keyframes pulseRedActive {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* 3. الرصاصي: لم يدخل في مسار الخطة (مثل R&D في إعادة التصنيع) */
.step-node.bypassed .step-circle {
    background: #f1f5f9 !important;
    border: 2px dashed #94a3b8 !important;
    color: #94a3b8 !important;
    box-shadow: none !important;
}
.step-node.bypassed .step-label {
    color: #94a3b8 !important;
    font-weight: 600 !important;
    text-decoration: line-through;
}

/* 4. الأزرق: لباقي الأقسام القادمة التي لم يصلها الدور بعد */
.step-node.pending .step-circle {
    background: #eff6ff !important;
    border: 2px solid #3b82f6 !important;
    color: #1d4ed8 !important;
    box-shadow: none !important;
}
.step-node.pending .step-label {
    color: #2563eb !important;
    font-weight: 600 !important;
}

/* موصلات المسار (Connectors) */
.step-connector {
    flex: 1;
    height: 3px;
    background-color: #93c5fd;
    margin: 0 4px;
    transform: translateY(-11px);
    transition: all 0.25s ease;
}

.step-connector.completed {
    background-color: #16a34a !important;
}

.step-connector.bypassed {
    background-color: transparent !important;
    border-top: 2px dashed #94a3b8 !important;
    height: 0px !important;
}

.step-connector.pending {
    background-color: #93c5fd !important;
}

.step-connector.active {
    background-color: #93c5fd !important;
}

/* Checklist Items Section */
.checklist-items-section {
    margin-bottom: 18px;
}

.checklist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.checklist-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.checklist-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checklist-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.checklist-name-side {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check-icon-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.check-icon-box.done {
    background: #d1fae5;
    color: #059669;
}

.check-icon-box.missing {
    background: #fee2e2;
    color: #dc2626;
}

.check-icon-box.pending {
    background: #fef3c7;
    color: #d97706;
}

.checklist-item-title {
    font-weight: 600;
    color: var(--text-primary);
}

.checklist-status-badge {
    font-size: 12px;
    font-weight: 600;
}

.plan-last-update {
    font-size: 11.5px;
    color: var(--text-dim);
    margin-top: 10px;
    text-align: left;
}

.watermark-note {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 12px;
    text-align: center;
    border-top: 1px dashed var(--border-light);
    padding-top: 10px;
}

/* Audit Trail Accordion */
.audit-trail-section {
    margin-top: 14px;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
}

.audit-summary {
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.chevron-icon {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

details[open] .chevron-icon {
    transform: rotate(180deg);
}

.audit-timeline {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 10px;
    border-right: 2px solid #e2e8f0;
}

.audit-item {
    position: relative;
    font-size: 12px;
}

.audit-item::before {
    content: '';
    position: absolute;
    right: -15px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.audit-item-meta {
    display: flex;
    gap: 8px;
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 2px;
}

.audit-item-text {
    color: var(--text-primary);
    line-height: 1.4;
}

/* Companies Grid View */
.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.company-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-card);
}

.company-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.company-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.company-products-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.company-product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
}

/* Reports Sheet */
.reports-container {
    max-width: 900px;
    margin: 0 auto;
}

.report-selection-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.report-select-row {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    align-items: center;
}

.printable-report-sheet,
    .printable-cancelled-sheet {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 36px 42px;
    box-shadow: var(--shadow-md);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 18px;
    margin-bottom: 20px;
}

.report-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.report-company-title {
    font-size: 16px;
    font-weight: 800;
}

.report-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

.report-meta-box {
    text-align: left;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.report-title-bar {
    background: #f1f5f9;
    padding: 10px 16px;
    border-radius: 4px;
    text-align: center;
    margin-bottom: 20px;
}

.report-title-bar h3 {
    font-size: 15px;
    font-weight: 700;
}

.report-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    background: #f8fafc;
    padding: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    font-size: 13px;
}

.report-section-h4 {
    font-size: 13.5px;
    font-weight: 700;
    margin: 18px 0 8px 0;
    color: #0f172a;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 4px;
}

.report-text-block {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    background: #ffffff;
    padding: 8px 12px;
    border: 1px dashed var(--border-color);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 20px 0;
    font-size: 12px;
}

.report-table th, .report-table td {
    border: 1px solid #cbd5e1;
    padding: 8px 10px;
    text-align: right;
}

.report-table th {
    background-color: #f1f5f9;
    font-weight: 700;
}

.signatures-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 14px;
}

.sign-box {
    border: 1px solid #cbd5e1;
    padding: 10px 8px;
    text-align: center;
    background: #fafafa;
    border-radius: 4px;
    font-size: 11.5px;
}

.sign-title {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 11px;
}

.sign-status {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
}

.sign-person {
    color: var(--text-dim);
    font-size: 10.5px;
}

/* Modals */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.active {
    display: flex;
}

.modal-dialog {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 620px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    animation: modalSlide 0.2s ease-out;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-dim);
    cursor: pointer;
}

.modal-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(92vh - 120px);
    overflow-y: scroll;
    scrollbar-width: thin;
    scrollbar-color: #0284c7 #f1f5f9;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    background: #f8fafc;
    flex-shrink: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.flex-1 {
    flex: 1;
}

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
    padding: 8px 12px;
    font-family: inherit;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
}

.action-choice-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
}

.action-plan-summary {
    background: #f1f5f9;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    border-right: 4px solid var(--primary);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: #1e293b;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: none;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print CSS: Dedicated Single Plan / Product BMR Report Sheet Only */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm 12mm;
    }

    body {
        background: #ffffff !important;
        color: #0f172a !important;
        font-family: 'Tajawal', sans-serif !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Completely hide navigation, bars, modals, buttons, and other views */
    .sidebar,
    .top-bar,
    .page-header,
    .report-selection-card,
    .btn,
    button,
    .modal-backdrop:not(#rawMaterialPoModal),
    .toast,
    .login-overlay,
    .view-panel,
    #dashboardView,
    #storeView,
    #productionView,
    #plansView,
    #companiesView,
    #adminView,
    .user-dropdown-menu,
    .role-permission-banner {
        display: none !important;
    }

    /* Make only reportsView and its sheet printable */
    .app-layout,
    .main-content,
    #reportsView {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
    }

    .reports-container {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    .printable-report-sheet,
    .printable-cancelled-sheet {
        display: block !important;
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 6px !important;
        padding: 18px 24px !important;
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        background: #ffffff !important;
    }

    .no-print { display: none !important; }
    /* Avoid page-breaks inside key summary sections */
    .report-header,
    .report-title-bar,
    .report-info-grid,
    .signatures-grid {
        page-break-inside: avoid;
    }

    .report-table {
        width: 100% !important;
        border-collapse: collapse !important;
        page-break-inside: auto;
    }

    .report-table tr {
        page-break-inside: avoid;
    }

    .report-table th,
    .report-table td {
        border: 1px solid #cbd5e1 !important;
        padding: 6px 10px !important;
        font-size: 11.5px !important;
        color: #1e293b !important;
    }

    .report-table th {
        background-color: #f1f5f9 !important;
        font-weight: 700 !important;
    }

    .sign-box {
        border: 1px solid #cbd5e1 !important;
        padding: 8px !important;
        background-color: #f8fafc !important;
    }
}

/* =========================================================
   V2.0 STYLES: Authentication, Store Tab, Production Tab, Admin Panel, 8-Stage Stepper
   ========================================================= */

/* Login Modal / Overlay — Dark Falcon Tracking Theme */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #121417;
    z-index: 1000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    overflow-y: auto;
}

.login-overlay.active {
    display: flex;
}

.login-card {
    background: transparent;
    width: 100%;
    max-width: 960px;
    padding: 12px 16px;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 34px;
    animation: modalSlide 0.25s ease-out;
}

.login-split-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 390px;
    gap: 44px;
    align-items: center;
    direction: ltr;
}

.login-form-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-title {
    font-size: 34px;
    font-weight: 800;
    color: #eab308;
    margin: 0;
    letter-spacing: 0.2px;
}

.login-subtitle {
    font-size: 14px;
    font-weight: 700;
    color: #f8fafc;
    margin-top: 6px;
}

.login-form-box {
    width: 100%;
    max-width: 310px;
}

.login-pill-input {
    width: 100%;
    background: #ffffff;
    color: #0f172a;
    border: 2px solid transparent;
    border-radius: 999px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    text-align: left;
    direction: ltr;
}

.login-pill-input::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

.login-pill-input:focus {
    border-color: #eab308;
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.25);
}

.login-btn-gold {
    width: 100%;
    margin-top: 8px;
    padding: 11px 20px;
    border-radius: 999px;
    background: #121417;
    color: #ffffff;
    border: 1.5px solid #eab308;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login-btn-gold:hover {
    background: #eab308;
    color: #0b0f17;
    box-shadow: 0 0 18px rgba(234, 179, 8, 0.35);
}

.login-art-col {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-falcon-frame {
    width: 380px;
    height: 380px;
    border-radius: 56px;
    background: #050608;
    padding: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.login-falcon-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 38px;
}

.quick-login-section {
    width: 100%;
    max-width: 920px;
    margin-top: 4px;
    padding: 10px 20px;
    border: 1.5px solid #eab308;
    border-radius: 999px;
    background: rgba(10, 12, 16, 0.75);
}

.quick-chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    align-items: center;
    direction: ltr;
}

.quick-chip {
    padding: 4px 10px;
    background: transparent;
    color: #38bdf8;
    border: none;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.quick-chip:hover {
    color: #fbbf24;
    background: rgba(234, 179, 8, 0.12);
}

.quick-chip-sep {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    user-select: none;
}

@media (max-width: 860px) {
    .login-split-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .login-falcon-frame {
        width: 240px;
        height: 240px;
        border-radius: 36px;
        padding: 12px;
    }
    .login-falcon-frame img {
        border-radius: 26px;
    }
    .quick-login-section {
        border-radius: 18px;
        padding: 10px 12px;
    }
}

/* User Scope & Permissions Banner */
.user-scope-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
}

.user-scope-banner.restricted {
    background: #fefce8;
    border-color: #fef08a;
    color: #854d0e;
}

/* 8-Stage Stepper Expansion */
.workflow-stepper-8 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 10px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    overflow-x: auto;
}

.workflow-stepper-8 .step-node {
    flex: 0 0 auto;
}

.workflow-stepper-8 .step-circle {
    width: 26px;
    height: 26px;
    font-size: 11px;
}

.workflow-stepper-8 .step-label {
    font-size: 10.5px;
}

/* Store & Production Cards Grid */
.dept-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.dept-op-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.2s;
}

.dept-op-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.dept-op-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.dept-op-batch {
    font-family: monospace;
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
}

.dept-op-product {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
}

.dept-op-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

/* Store Inspection Form */
.store-inspection-box {
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.inspection-check-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
}

.radio-pill-group {
    display: flex;
    gap: 6px;
}

.radio-pill-label {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.radio-pill-label input {
    display: none;
}

.radio-pill-label.active-success {
    background: var(--success-light);
    color: var(--success-text);
    border-color: var(--success);
}

.radio-pill-label.active-danger {
    background: var(--danger-light);
    color: var(--danger-text);
    border-color: var(--danger);
}

.missing-supplies-panel {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-top: 6px;
}

.missing-supplies-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #9f1239;
    margin-bottom: 8px;
}

.supplies-chips-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.supply-chip-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ffffff;
    border: 1px solid #fda4af;
    color: #881337;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    user-select: none;
}

.supply-chip-checkbox input {
    cursor: pointer;
}

/* Production Operations Card */
.production-time-box {
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prod-step-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.prod-time-val {
    font-family: monospace;
    font-size: 12.5px;
    font-weight: 700;
    color: #0369a1;
}

/* Admin Panel Tabs & Layout */
.admin-tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.admin-tab-btn {
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: -2px;
}

.admin-tab-btn:hover {
    color: var(--text-primary);
}

.admin-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.admin-sub-panel {
    display: none;
}

.admin-sub-panel.active {
    display: block;
}

/* Switch / Toggle slider */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #10b981;
}

input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* Active KPI Card Highlight */
.kpi-card {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.kpi-card.kpi-active {
    border-color: #2563eb !important;
    background-color: #eff6ff !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25) !important;
    transform: translateY(-2px);
}
.kpi-card-warning.kpi-active {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

/* Sales Procedures & Actions Modal Styling */
.sales-action-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
    transition: all 0.2s ease;
}
.sales-action-card:hover {
    border-color: #cbd5e1;
}
.sales-action-card.highlight-card {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.sales-action-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.sales-action-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.sales-action-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.sales-action-desc {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 10px;
    line-height: 1.5;
}
.attachments-list-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    min-height: 48px;
    max-height: 190px;
    overflow-y: auto;
    padding: 4px 6px;
}
.attachment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
}
.attachment-row:last-child {
    border-bottom: none;
}
.attachment-info-col {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-name {
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
}
.attachment-name:hover {
    color: #2563eb;
    text-decoration: underline;
}
.attachment-meta {
    font-size: 11px;
    color: #94a3b8;
}
.attachment-actions-col {
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-delete-att {
    color: #dc2626;
    background: #fee2e2;
    border: none;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 600;
}
.btn-delete-att:hover {
    background: #fca5a5;
}

/* Report Sub-Tabs */
.btn-tab {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-tab:hover {
    background: #e2e8f0;
}
.btn-tab.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}
#tabReportCancelled.active {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
    color: #ffffff !important;
}

/* Companies & Products Interactive Table */
.company-row-clickable {
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.company-row-clickable:hover {
    background-color: #f1f5f9 !important;
}
.company-row-selected {
    background-color: #e0f2fe !important;
    border-right: 4px solid #0284c7 !important;
    font-weight: 600;
}
.supply-tag {
    display: inline-block;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 11px;
    margin: 2px;
}


/* Sales Samples Compact Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
    text-align: right;
}
.data-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 7px 9px;
    border-bottom: 2px solid #e2e8f0;
    font-size: 11px;
    white-space: nowrap;
}
.data-table td {
    padding: 7px 9px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 11.5px;
}
.data-table tr:hover td {
    background-color: #f8fafc;
}


/* Modal Dialog Flex & Sticky Footer Fix */
.modal-dialog form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.modal-dialog .modal-header {
    flex-shrink: 0;
}
.modal-dialog .modal-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}


/* Red Circular Notification Badge for Sidebar */
.sidebar-notification-badge {
    background-color: #ef4444 !important;
    color: #ffffff !important;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    margin-right: auto;
    padding: 0 4px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45);
}

/* =================================================== */
/* Universal Modal Scrollbar & Fixed-Height Layout Fix */
/* =================================================== */
#productionBatchMrpModal .modal-dialog {
    height: 90vh !important;
    max-height: 92vh !important;
    max-width: 1120px !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#productionBatchMrpModal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-y: auto !important;
    padding: 10px 16px !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#productionBatchMrpModal .mrp-table-scroll-container {
    flex: 1 1 auto;
    min-height: 220px;
    max-height: 52vh;
    overflow-y: auto !important;
    overflow-x: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: #0284c7 #f1f5f9 !important;
}

#productionBatchMrpModal .mrp-table-scroll-container::-webkit-scrollbar {
    width: 9px !important;
    height: 9px !important;
    display: block !important;
}

#productionBatchMrpModal .mrp-table-scroll-container::-webkit-scrollbar-track {
    background: #f1f5f9 !important;
    border-radius: 4px !important;
}

#productionBatchMrpModal .mrp-table-scroll-container::-webkit-scrollbar-thumb {
    background: #0284c7 !important;
    border-radius: 4px !important;
}

#productionBatchMrpModal .mrp-table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #0369a1 !important;
}

#rawMaterialPoModal .modal-dialog,
#rdSampleRecipeModal .modal-dialog,
#qaViewSampleRecipeModal .modal-dialog,
#rawMaterialsInventoryModal .modal-dialog {
    height: 88vh;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#productionBatchMrpModal .modal-header,
#productionBatchMrpModal .modal-footer,
#rawMaterialPoModal .modal-header,
#rawMaterialPoModal .modal-footer,
#rdSampleRecipeModal .modal-header,
#rdSampleRecipeModal .modal-footer,
#qaViewSampleRecipeModal .modal-header,
#qaViewSampleRecipeModal .modal-footer,
#rawMaterialsInventoryModal .modal-header,
#rawMaterialsInventoryModal .modal-footer {
    flex-shrink: 0;
}

#productionBatchMrpModal .modal-body,
#rawMaterialPoModal .modal-body,
#rdSampleRecipeModal .modal-body,
#qaViewSampleRecipeModal .modal-body,
#rawMaterialsInventoryModal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-y: scroll !important;
    scrollbar-width: thin !important;
    scrollbar-color: #0284c7 #f1f5f9 !important;
}

/* Prominent Visible Scrollbar Styling (Chrome / Edge / Safari / Opera) */
.modal-body::-webkit-scrollbar,
#productionBatchMrpModal .modal-body::-webkit-scrollbar,
#rawMaterialPoModal .modal-body::-webkit-scrollbar,
#rdSampleRecipeModal .modal-body::-webkit-scrollbar,
#qaViewSampleRecipeModal .modal-body::-webkit-scrollbar,
#rawMaterialsStockModal .modal-body::-webkit-scrollbar {
    width: 11px !important;
    height: 11px !important;
    display: block !important;
}

.modal-body::-webkit-scrollbar-track,
#productionBatchMrpModal .modal-body::-webkit-scrollbar-track,
#rawMaterialPoModal .modal-body::-webkit-scrollbar-track {
    background: #f1f5f9 !important;
    border-radius: 6px !important;
}

.modal-body::-webkit-scrollbar-thumb,
#productionBatchMrpModal .modal-body::-webkit-scrollbar-thumb,
#rawMaterialPoModal .modal-body::-webkit-scrollbar-thumb {
    background: #0284c7 !important;
    border-radius: 6px !important;
    border: 2px solid #f1f5f9 !important;
}

.modal-body::-webkit-scrollbar-thumb:hover,
#productionBatchMrpModal .modal-body::-webkit-scrollbar-thumb:hover {
    background: #0369a1 !important;
}

/* =================================================== */
/* Printable Purchase Order (PO) Styles */
/* =================================================== */
#printablePoSheet,
#printablePoSheet * {
    font-family: 'El Messiri', 'Tajawal', sans-serif !important;
}

body.printing-po-active * {
    visibility: hidden !important;
}

body.printing-po-active #rawMaterialPoModal,
body.printing-po-active #rawMaterialPoModal .modal-dialog,
body.printing-po-active #rawMaterialPoModal .modal-body,
body.printing-po-active #printablePoSheet,
body.printing-po-active #printablePoSheet * {
    visibility: visible !important;
    font-family: 'El Messiri', 'Tajawal', sans-serif !important;
}

body.printing-po-active #rawMaterialPoModal {
    display: block !important;
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.printing-po-active #rawMaterialPoModal .modal-dialog,
body.printing-po-active #rawMaterialPoModal .modal-body {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

body.printing-po-active #rawMaterialPoModal .modal-header,
body.printing-po-active #rawMaterialPoModal .modal-footer,
body.printing-po-active #reportsView,
body.printing-po-active .app-layout {
    display: none !important;
}


/* ==========================================================================
   Compact Workspace Mode: Hide redundant section page-headers to save space
   ========================================================================== */
#dashboardView > .page-header,
#storeView > .page-header,
#productionView > .page-header,
#plansView > .page-header,
#rdSamplesView > .page-header,
#reportsView > .page-header {
    display: none !important;
}

#companiesView > .page-header .page-title,
#companiesView > .page-header .page-subtitle,
#chairmanView > .page-header .page-title,
#chairmanView > .page-header .page-subtitle,
#rdManagerView > .page-header .page-title,
#rdManagerView > .page-header .page-subtitle,
#adminView > .page-header .page-title,
#adminView > .page-header .page-subtitle {
    display: none !important;
}

#companiesView > .page-header,
#chairmanView > .page-header,
#rdManagerView > .page-header,
#adminView > .page-header {
    margin-bottom: 10px !important;
    padding: 0 !important;
    min-height: auto !important;
}

#appAlertModal, #appConfirmModal { z-index: 99999 !important; }

/* Selected Plan Wide Modal (عرض وتتبع الخطة) */
.selected-plan-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(3px);
    z-index: 900;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.selected-plan-modal-backdrop.is-open {
    display: flex;
}
.selected-plan-modal-frame {
    width: min(96vw, 1440px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
    border: 2px solid #0b0f17;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.45);
    overflow: hidden;
}
.selected-plan-modal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: #0b0f17;
    color: #ffffff;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}
.selected-plan-modal-close-x {
    background: #ef4444;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s;
}
.selected-plan-modal-close-x:hover {
    background: #dc2626;
}
.selected-plan-modal-grid {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 12px;
    padding: 12px;
    align-items: stretch;
    margin: 0 !important;
}
@media (max-width: 1024px) {
    .selected-plan-modal-grid {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
}
.selected-plan-modal-backdrop .selected-plan-card,
.selected-plan-modal-backdrop .stage-distribution-card {
    width: 100%;
    max-height: calc(92vh - 76px);
    overflow-y: auto;
    margin: 0 !important;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    background: #ffffff;
}
.selected-plan-modal-backdrop .selected-plan-header {
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 15;
    padding-top: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}
