/* ===========================
   IT Project Plans Module
   Page-specific Styles
   =========================== */

/* --- Page Header with Actions --- */
.pp-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.pp-page-header-text h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-secondary);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.pp-page-header-text p {
  font-size: 0.938rem;
  color: var(--color-text-light);
}

.pp-page-header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* --- Toolbar --- */
.pp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.pp-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.pp-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pp-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg-alt);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: all var(--transition);
  min-width: 220px;
}

.pp-search-box:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
  background: var(--color-bg);
}

.pp-search-box svg {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.pp-search-box input {
  border: none;
  background: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 0.875rem;
  color: var(--color-text);
  width: 100%;
}

.pp-search-box input::placeholder {
  color: var(--color-text-muted);
}

.pp-filter-select {
  padding: 8px 36px 8px 14px;
  font-family: var(--font-family);
  font-size: 0.813rem;
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.pp-filter-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* --- Table Card --- */
.pp-table-card {
  margin-bottom: 40px;
  overflow: hidden;
}

.pp-table-card .data-table td:first-child {
  color: var(--color-primary);
  cursor: pointer;
}

.pp-table-card .data-table td:first-child:hover {
  text-decoration: underline;
}

/* --- Progress Bar --- */
.pp-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-border-light);
  border-radius: 50px;
  overflow: hidden;
  position: relative;
}

.pp-progress-bar-lg {
  height: 10px;
}

.pp-progress-fill {
  height: 100%;
  border-radius: 50px;
  background: var(--color-primary);
  transition: width 0.5s ease;
  min-width: 0;
}

.pp-progress-fill.progress-success {
  background: var(--color-success);
}

.pp-progress-fill.progress-warning {
  background: var(--color-warning);
}

.pp-progress-fill.progress-info {
  background: var(--color-info);
}

.pp-progress-fill.progress-danger {
  background: var(--color-danger);
}

.pp-progress-cell {
  min-width: 140px;
}

.pp-progress-cell-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pp-progress-cell-inner .pp-progress-bar {
  flex: 1;
}

.pp-progress-pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

/* --- Priority Badges --- */
.pp-priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.688rem;
  font-weight: 600;
  white-space: nowrap;
}

.pp-priority-badge.priority-critical {
  background: #fef2f2;
  color: #dc2626;
}

.pp-priority-badge.priority-high {
  background: #fff7ed;
  color: #ea580c;
}

.pp-priority-badge.priority-medium {
  background: #fefce8;
  color: #ca8a04;
}

.pp-priority-badge.priority-low {
  background: #f0fdf4;
  color: #16a34a;
}

.pp-priority-badge-sm {
  font-size: 0.6rem;
  padding: 2px 7px;
  margin-top: 6px;
}

/* --- Table Action Buttons --- */
.pp-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pp-row-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-light);
  cursor: pointer;
  transition: all var(--transition);
}

.pp-row-action-btn:hover {
  background: var(--color-bg-alt);
  color: var(--color-primary);
  border-color: var(--color-primary-light);
}

.pp-row-action-btn.btn-danger:hover {
  color: var(--color-danger);
  border-color: var(--color-danger-light);
  background: var(--color-danger-light);
}

.pp-row-action-btn svg {
  width: 14px;
  height: 14px;
}

/* --- Column Sorting --- */
.pp-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  white-space: nowrap;
}

.pp-sortable:hover {
  color: var(--color-primary);
}

.pp-sort-icon {
  display: inline-block;
  width: 12px;
  margin-left: 4px;
  opacity: 0.3;
}

.pp-sort-icon::after {
  content: '\2195';
  font-size: 10px;
}

.pp-sortable.sort-asc .pp-sort-icon {
  opacity: 1;
}

.pp-sortable.sort-asc .pp-sort-icon::after {
  content: '\2191';
}

.pp-sortable.sort-desc .pp-sort-icon {
  opacity: 1;
}

.pp-sortable.sort-desc .pp-sort-icon::after {
  content: '\2193';
}

/* --- Roadmap Section --- */
.pp-roadmap-section {
  margin-bottom: 28px;
}

.pp-roadmap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.pp-roadmap-col {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.pp-roadmap-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 0.813rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid transparent;
}

.pp-roadmap-col-header.pp-roadmap-planned {
  background: var(--color-primary-50);
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.pp-roadmap-col-header.pp-roadmap-inprogress {
  background: var(--color-info-light);
  color: #0e7490;
  border-bottom-color: var(--color-info);
}

.pp-roadmap-col-header.pp-roadmap-completed {
  background: var(--color-success-light);
  color: #047857;
  border-bottom-color: var(--color-success);
}

.pp-roadmap-count {
  margin-left: auto;
  background: rgba(0,0,0,0.08);
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 0.688rem;
}

.pp-roadmap-col-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
}

.pp-roadmap-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition);
}

.pp-roadmap-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.pp-roadmap-card-title {
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.pp-roadmap-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pp-roadmap-card-owner {
  font-size: 0.688rem;
  color: var(--color-text-muted);
}

.pp-roadmap-card-progress {
  font-size: 0.688rem;
  font-weight: 700;
  color: var(--color-text-light);
}

.pp-roadmap-card .pp-progress-bar {
  height: 4px;
  margin-top: 8px;
}

.pp-roadmap-empty {
  text-align: center;
  padding: 20px 12px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* --- Detail Modal --- */
.pp-detail-modal {
  max-width: 700px;
  width: 95%;
  text-align: left;
  padding: 0;
  max-height: 90vh;
  overflow-y: auto;
}

.pp-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  z-index: 10;
}

.pp-modal-close:hover {
  color: var(--color-text);
  background: var(--color-bg-alt);
}

.pp-detail-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.pp-detail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-primary-50);
  color: var(--color-primary);
  flex-shrink: 0;
}

.pp-detail-header h3 {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-secondary);
  min-width: 0;
}

.pp-detail-body {
  padding: 24px 32px 32px;
}

.pp-detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.pp-detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pp-detail-meta-label {
  font-size: 0.688rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pp-detail-meta-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.pp-detail-progress-section {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
}

.pp-detail-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--color-text);
}

.pp-detail-section {
  margin-bottom: 20px;
}

.pp-detail-section:last-child {
  margin-bottom: 0;
}

.pp-detail-section h4 {
  font-size: 0.813rem;
  font-weight: 700;
  color: var(--color-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-light);
}

.pp-detail-section p {
  font-size: 0.875rem;
  color: var(--color-text-light);
  line-height: 1.7;
}

.pp-detail-notes {
  background: var(--color-bg-alt);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-style: italic;
}

/* --- Detail Actions Bar --- */
.pp-detail-actions-bar {
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
}

.btn-success {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

.btn-success:hover {
  background: #047857;
  border-color: #047857;
}

/* --- Milestone List --- */
.pp-milestone-list {
  list-style: none;
}

.pp-milestone-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.875rem;
}

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

.pp-milestone-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.pp-milestone-icon.done {
  background: var(--color-success-light);
  color: var(--color-success);
}

.pp-milestone-icon.pending {
  background: var(--color-border-light);
  color: var(--color-text-muted);
}

.pp-milestone-icon svg {
  width: 12px;
  height: 12px;
}

.pp-milestone-text {
  flex: 1;
  color: var(--color-text);
}

.pp-milestone-text.done-text {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.pp-milestone-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.pp-milestone-budget,
.pp-task-budget {
  font-size: 0.688rem;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  padding: 2px 8px;
  border-radius: 50px;
  white-space: nowrap;
  font-weight: 600;
}

/* --- Task List --- */
.pp-task-progress-header {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.pp-task-list {
  list-style: none;
}

.pp-task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.875rem;
  color: var(--color-text);
}

.pp-task-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  margin-top: 2px;
}

.pp-task-check.checked {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

.pp-task-check svg {
  width: 12px;
  height: 12px;
}

.pp-task-text {
  flex: 1;
}

.pp-task-text.done-text {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

/* --- Form Modal --- */
.pp-form-modal {
  max-width: 600px;
  width: 95%;
  text-align: left;
  padding: 32px;
  max-height: 90vh;
  overflow-y: auto;
}

.pp-form-modal h3 {
  text-align: left;
  margin-bottom: 24px;
}

.pp-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.form-hint {
  display: block;
  font-size: 0.688rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* --- Delete Modal --- */
.pp-delete-modal {
  max-width: 480px;
}

.pp-delete-warning {
  font-size: 0.813rem;
  color: var(--color-text-light);
  margin-top: 8px;
}

.pp-delete-warning-final {
  color: var(--color-danger);
  font-weight: 600;
}

/* --- Status Badge Extensions --- */
.status-badge.planned {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.status-badge.on-hold {
  background: var(--color-warning-light);
  color: #b45309;
}

.status-badge.completed {
  background: var(--color-success-light);
  color: #047857;
}

.status-badge.status-custom {
  background: #f0f0ff;
  color: #6366f1;
}

/* --- Category Badge --- */
.pp-category-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.688rem;
  font-weight: 600;
  white-space: nowrap;
}

.pp-category-badge.cat-infrastructure {
  background: var(--color-info-light);
  color: #0e7490;
}

.pp-category-badge.cat-software {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.pp-category-badge.cat-security {
  background: var(--color-danger-light);
  color: #b91c1c;
}

.pp-category-badge.cat-hardware {
  background: var(--color-warning-light);
  color: #b45309;
}

.pp-category-badge.cat-custom {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* --- Stat Card as Filter --- */
.stat-card-clickable {
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

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

.stat-card-clickable::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  transition: background var(--transition);
}

.stat-card-clickable.stat-card-active {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

#statCardTotal.stat-card-active::after {
  background: var(--color-primary);
}

#statCardInProgress.stat-card-active::after {
  background: var(--color-info);
}

#statCardCompleted.stat-card-active::after {
  background: var(--color-success);
}

#statCardOnHold.stat-card-active::after {
  background: var(--color-warning);
}

.stat-card-clickable .stat-label::after {
  content: ' (click to filter)';
  font-size: 0.6rem;
  color: var(--color-text-muted);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card-clickable:hover .stat-label::after {
  opacity: 1;
}

/* --- Detail Export Bar --- */
.pp-detail-export-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border-light);
}

/* --- Section Header with Add button --- */
.pp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pp-section-header h4 {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.688rem;
  gap: 4px;
}

/* --- Auto-calc badge --- */
.pp-auto-calc-badge {
  font-size: 0.625rem;
  font-weight: 400;
  color: var(--color-text-muted);
  font-style: italic;
}

/* --- Item Delete Button (Tasks/Milestones) --- */
.pp-item-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
  opacity: 0;
}

.pp-milestone-item:hover .pp-item-delete-btn,
.pp-task-item:hover .pp-item-delete-btn {
  opacity: 1;
}

.pp-item-delete-btn:hover {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.pp-item-delete-btn:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

/* --- Milestone toggle cursor --- */
.pp-milestone-toggle {
  cursor: pointer;
}

/* --- Empty message for tasks/milestones --- */
.pp-empty-msg {
  font-size: 0.813rem;
  color: var(--color-text-muted);
  padding: 12px 0;
  text-align: center;
  font-style: italic;
}

/* --- Category Manager Styles --- */
.pp-modal-subtitle {
  font-size: 0.813rem;
  color: var(--color-text-light);
  margin-bottom: 20px;
}

.pp-category-manager {
  margin-bottom: 8px;
}

.pp-category-add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.pp-category-input {
  flex: 1;
  padding: 8px 14px;
  font-family: var(--font-family);
  font-size: 0.875rem;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  outline: none;
  transition: all var(--transition);
}

.pp-category-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.pp-category-list {
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
}

.pp-category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-light);
}

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

.pp-category-count {
  margin-left: auto;
  font-size: 0.688rem;
  color: var(--color-text-muted);
  margin-right: 6px;
}

.pp-category-item .pp-item-delete-btn {
  opacity: 1;
}

.pp-manage-cat-btn {
  white-space: nowrap;
}

/* --- Small Modal (Add Task / Add Milestone / Assign) --- */
.pp-small-modal {
  max-width: 440px;
  width: 95%;
  text-align: left;
  padding: 32px;
  max-height: 90vh;
  overflow-y: auto;
}

.pp-small-modal h3 {
  text-align: left;
  margin-bottom: 20px;
}

/* --- Notification Modal --- */
.pp-notification-modal {
  max-width: 480px;
  width: 95%;
  text-align: left;
  padding: 32px;
  max-height: 80vh;
  overflow-y: auto;
}

.pp-notification-modal p {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-text-light);
  margin-bottom: 8px;
}

.pp-notification-modal p strong {
  color: var(--color-text);
}

.pp-notification-link {
  margin-top: 12px;
}

.pp-notification-link code {
  font-size: 0.75rem;
  background: var(--color-bg-alt);
  padding: 4px 8px;
  border-radius: 4px;
  word-break: break-all;
}

/* --- Checkbox Label --- */
.pp-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.813rem;
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
}

.pp-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
}

/* --- Employee List in Detail --- */
.pp-employee-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-light);
}

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

.pp-employee-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.pp-employee-details {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pp-employee-name {
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--color-text);
}

.pp-employee-email {
  font-size: 0.688rem;
  color: var(--color-text-muted);
}

.pp-employee-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Budget Section --- */
.pp-budget-overview {
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  padding: 16px;
}

.pp-budget-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.813rem;
}

.pp-budget-label {
  color: var(--color-text-light);
}

.pp-budget-value {
  color: var(--color-text);
  font-weight: 500;
}

.pp-budget-value strong {
  color: var(--color-secondary);
}

.pp-budget-row-total {
  font-weight: 600;
}

.pp-budget-row-total .pp-budget-label {
  color: var(--color-text);
}

.pp-budget-negative {
  color: var(--color-danger) !important;
}

.pp-budget-divider {
  height: 1px;
  background: var(--color-border);
  margin: 8px 0;
}

.pp-budget-bar-section {
  margin-top: 12px;
}

.pp-budget-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.pp-budget-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pp-budget-status.budget-over {
  background: #fef2f2;
  color: #dc2626;
}

.pp-budget-status.budget-exact {
  background: #f0fdf4;
  color: #16a34a;
}

.pp-budget-status.budget-under {
  background: #f0fdf4;
  color: #16a34a;
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
  .pp-roadmap-grid {
    grid-template-columns: 1fr;
  }

  .pp-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .pp-toolbar-left {
    width: 100%;
  }

  .pp-toolbar-right {
    width: 100%;
    justify-content: flex-start;
  }

  .pp-detail-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
  .pp-page-header {
    flex-direction: column;
    gap: 16px;
  }

  .pp-page-header-actions {
    width: 100%;
  }

  .pp-page-header-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .pp-search-box {
    min-width: 0;
    width: 100%;
  }

  .pp-filter-select {
    width: 100%;
  }

  .pp-toolbar-left {
    flex-direction: column;
    align-items: stretch;
  }

  .pp-toolbar-right {
    flex-wrap: wrap;
  }

  .pp-detail-modal,
  .pp-form-modal,
  .pp-small-modal,
  .pp-notification-modal {
    width: 100%;
    max-height: 100vh;
    border-radius: var(--radius-md);
  }

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

  .pp-detail-body {
    padding: 20px;
  }

  .pp-detail-export-bar {
    padding: 10px 20px;
    flex-wrap: wrap;
  }

  .pp-form-modal,
  .pp-small-modal {
    padding: 24px 20px;
  }

  .pp-detail-meta-grid {
    grid-template-columns: 1fr;
  }

  .stat-card-clickable .stat-label::after {
    display: none;
  }

  .pp-item-delete-btn {
    opacity: 1;
  }

  .pp-employee-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .pp-employee-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .pp-toolbar-right .btn span {
    display: none;
  }
}

/* --- Login Modal (Modern with Logo) --- */
.pp-login-modal {
  max-width: 420px;
  width: 100%;
  text-align: center;
  padding: 40px 36px 32px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.pp-login-branding {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.pp-login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 8px rgba(45, 27, 142, 0.15));
}

.pp-login-brand-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: 2px;
  margin: 0;
}

.pp-login-brand-sub {
  font-size: 0.813rem;
  color: var(--color-text-light);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.pp-login-divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 2px;
  margin: 16px auto;
}

.pp-login-modal h3 {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--color-text);
}

.pp-login-modal .pp-modal-subtitle {
  margin-bottom: 20px;
  color: var(--color-text-light);
  font-size: 0.875rem;
}

.pp-login-modal .form-group {
  text-align: left;
}

.pp-login-modal .form-group input {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.938rem;
  border: 1.5px solid var(--color-border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pp-login-modal .form-group input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45, 27, 142, 0.1);
}

.pp-login-modal .btn-primary {
  border-radius: 10px;
  padding: 12px 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pp-login-footer-text {
  margin-top: 20px;
  font-size: 0.75rem;
  color: var(--color-text-light);
  opacity: 0.7;
}

#loginModal {
  background: linear-gradient(135deg, rgba(45, 27, 142, 0.08), rgba(99, 102, 241, 0.06));
  backdrop-filter: blur(6px);
}

.pp-login-error {
  background: #fef2f2;
  color: #dc2626;
  font-size: 0.813rem;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid #fecaca;
}

/* --- Admin Manage Buttons (same line) --- */
.pp-admin-manage-btns {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* --- Task Content with Meta --- */
.pp-task-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pp-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.pp-task-assigned,
.pp-task-done-by {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 50px;
  white-space: nowrap;
}

.pp-task-assigned {
  background: #ede9fe;
  color: #6d28d9;
}

.pp-task-done-by {
  background: #d1fae5;
  color: #047857;
}

.pp-time-elapsed {
  font-size: 0.625rem;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  padding: 1px 6px;
  border-radius: 50px;
  white-space: nowrap;
}

.pp-item-note {
  font-size: 0.688rem;
  color: var(--color-text-light);
  font-style: italic;
  padding: 2px 0;
}

/* --- Milestone Content with Meta --- */
.pp-milestone-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* --- Task Assign Button --- */
.pp-task-assign-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
  opacity: 0;
}

.pp-task-item:hover .pp-task-assign-btn {
  opacity: 1;
}

.pp-task-assign-btn:hover {
  background: #ede9fe;
  color: #6d28d9;
}

/* --- Edit Button for Tasks/Milestones --- */
.pp-item-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
  opacity: 0;
}

.pp-milestone-item:hover .pp-item-edit-btn,
.pp-task-item:hover .pp-item-edit-btn {
  opacity: 1;
}

.pp-item-edit-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* --- Access Level Badge --- */
.pp-access-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 0.625rem;
  font-weight: 600;
  white-space: nowrap;
}

.pp-access-view {
  background: #f1f5f9;
  color: #64748b;
}

.pp-access-edit {
  background: #ede9fe;
  color: #6d28d9;
}

.pp-access-read {
  background: #f1f5f9;
  color: #475569;
}

.pp-access-full {
  background: #dcfce7;
  color: #166534;
}

.pp-access-admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.pp-access-none {
  background: #fee2e2;
  color: #b91c1c;
}

/* --- Employee Access Select in Detail --- */
.pp-emp-access-select {
  max-width: 120px;
}

/* --- View Toggle --- */
.pp-view-toggle {
  display: flex;
  gap: 4px;
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--color-border);
}

.pp-view-btn {
  border-radius: calc(var(--radius-sm) - 2px) !important;
  border: none !important;
  padding: 6px 14px !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  background: transparent !important;
  color: var(--color-text-light) !important;
  transition: all var(--transition);
}

.pp-view-btn.active {
  background: var(--color-primary) !important;
  color: #fff !important;
}

.pp-view-btn:hover:not(.active) {
  background: var(--color-bg) !important;
}

/* --- Owner Checkboxes in Form --- */
.pp-owners-select-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--color-bg-alt);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  max-height: 180px;
  overflow-y: auto;
}

.pp-owner-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.813rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.pp-owner-checkbox:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.pp-owner-checkbox input:checked + .pp-owner-email-hint {
  color: var(--color-primary);
}

.pp-owner-email-hint {
  font-size: 0.688rem;
  color: var(--color-text-muted);
}

/* --- Archive table button styles --- */
.btn-warning {
  color: #b45309 !important;
}

.btn-warning:hover {
  background: #fef3c7 !important;
}

.pp-archive-restore-btn {
  color: var(--color-primary) !important;
}

.pp-archive-restore-btn:hover {
  background: var(--color-primary-light) !important;
}

/* --- Budget Overview Section --- */
.pp-budget-overview-section {
  margin-top: 28px;
}

.pp-budget-overview-section .page-header h1 {
  font-size: 1.25rem;
}

.pp-budget-project-name {
  font-weight: 600;
  color: var(--color-secondary);
}

.pp-budget-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 50px;
  font-size: 0.688rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pp-budget-status-badge.budget-over {
  background: #fef2f2;
  color: #dc2626;
}

.pp-budget-status-badge.budget-exact {
  background: #fefce8;
  color: #ca8a04;
}

.pp-budget-status-badge.budget-under {
  background: #f0fdf4;
  color: #16a34a;
}

.pp-budget-total-row {
  background: var(--color-bg-alt);
  border-top: 2px solid var(--color-primary);
}

.pp-budget-total-row td {
  font-weight: 700;
}

.pp-table-empty-msg {
  text-align: center;
  padding: 20px;
  color: var(--color-text-muted);
  font-style: italic;
}

/* --- Subproject Cards --- */
.pp-subproject-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.pp-subproject-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.pp-subproject-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--color-secondary);
}

.pp-subproject-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.pp-subproject-progress {
  color: var(--color-primary);
  font-weight: 600;
}

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

.pp-subproject-actions {
  display: flex;
  gap: 6px;
}

.pp-subtask-list {
  padding-left: 0;
  list-style: none;
  margin-top: 4px;
}

.pp-subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.813rem;
}

.pp-subtask-text {
  font-size: 0.813rem;
}

.pp-subtask-done-by {
  font-size: 0.625rem !important;
  padding: 1px 6px !important;
}

.pp-subtasks-container {
  margin-top: 6px;
  margin-left: 24px;
  padding-left: 10px;
  border-left: 2px solid var(--color-border);
}

.pp-subtasks-header {
  font-size: 0.688rem;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.pp-subtask-check {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
}

.pp-add-subtask-btn,
.pp-add-subtask-inline {
  margin-top: 8px;
  font-size: 0.688rem !important;
  padding: 3px 10px !important;
}

/* --- Activity Log --- */
.pp-log-action {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 600;
}

/* --- User Management --- */
.pp-user-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pp-user-add-row .pp-category-input {
  flex: 1;
  min-width: 120px;
}

.pp-user-info {
  flex: 1;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* --- Users Modal Wide --- */
.pp-users-modal-wide {
  max-width: 720px;
}

.pp-user-add-form {
  background: var(--color-bg-alt);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.pp-user-add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pp-user-add-grid .form-group {
  margin-bottom: 0;
}

.pp-user-add-grid .form-group label {
  font-size: 0.688rem;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
  display: block;
}

.pp-file-input {
  font-size: 0.75rem;
  padding: 4px;
}

.pp-users-list {
  max-height: 350px;
  overflow-y: auto;
}

/* --- User Card in List --- */
.pp-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
}

.pp-user-card:last-child {
  border-bottom: none;
}

.pp-user-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.pp-user-card-photo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.pp-user-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.pp-user-card-info {
  min-width: 0;
}

.pp-user-card-name {
  font-weight: 600;
  font-size: 0.813rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-user-card-email {
  font-size: 0.688rem;
  color: var(--color-text-muted);
}

.pp-user-card-meta {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.pp-user-card-position {
  font-size: 0.625rem;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
}

.pp-user-card-dept {
  font-size: 0.625rem;
  color: var(--color-text-light);
  background: var(--color-bg-alt);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
}

.pp-user-card-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* --- Employee Photo in Detail --- */
.pp-employee-photo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.pp-employee-position {
  font-size: 0.625rem;
  color: var(--color-text-light);
  display: block;
  margin-top: 1px;
}

/* --- Avatar Image (sidebar/header) --- */
.pp-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* --- Print adjustments for new sections --- */
/* ===========================
   Modern User Form Modal
   =========================== */
.uf-modal {
  max-width: 680px;
  width: 95%;
  padding: 0;
  overflow: hidden;
  position: relative;
}

.uf-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-bg-alt);
}

.uf-header-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.uf-modal h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-secondary);
  margin-bottom: 2px;
}

.uf-subtitle {
  font-size: 0.813rem;
  color: var(--color-text-light);
  margin: 0;
}

.uf-modal form {
  padding: 24px 32px 0;
  max-height: calc(90vh - 100px);
  overflow-y: auto;
}

.uf-section {
  margin-bottom: 24px;
}

.uf-section:last-of-type {
  margin-bottom: 0;
}

.uf-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-light);
}

.uf-section-label svg {
  flex-shrink: 0;
}

.uf-section-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: -6px 0 12px;
}

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

.uf-field label {
  display: block;
  font-size: 0.688rem;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.uf-field input,
.uf-field select {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-family);
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition);
}

.uf-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

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

.uf-field input:focus,
.uf-field select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.uf-file-input {
  font-size: 0.75rem;
  padding: 7px 10px;
  cursor: pointer;
}

.uf-file-input::file-selector-button {
  font-family: var(--font-family);
  font-size: 0.688rem;
  font-weight: 600;
  padding: 4px 12px;
  margin-right: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
}

.uf-file-input::file-selector-button:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Module Access Cards */
.uf-modules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.uf-module-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--color-bg-alt);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.uf-module-card:hover {
  border-color: var(--color-primary-light);
  background: var(--color-primary-50);
}

.uf-module-card.uf-module-active {
  border-color: var(--color-primary);
  background: var(--color-primary-50);
}

.uf-module-check {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  background: var(--color-bg);
}

.uf-module-card.uf-module-active .uf-module-check {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.uf-module-check svg {
  display: none;
}

.uf-module-card.uf-module-active .uf-module-check svg {
  display: block;
}

.uf-module-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.uf-module-name {
  font-size: 0.813rem;
  font-weight: 500;
  color: var(--color-text);
}

.uf-module-card.uf-module-active .uf-module-name {
  color: var(--color-primary);
  font-weight: 600;
}

/* Form Actions */
.uf-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px 0;
  margin-top: 24px;
  border-top: 1px solid var(--color-border-light);
}

.uf-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Responsive */
@media (max-width: 600px) {
  .uf-modal {
    width: 98%;
  }

  .uf-header {
    padding: 20px;
  }

  .uf-modal form {
    padding: 16px 20px 20px;
  }

  .uf-grid {
    grid-template-columns: 1fr;
  }

  .uf-modules-grid {
    grid-template-columns: 1fr;
  }

  .uf-actions {
    padding: 16px 0;
  }
}

@media print {
  .pp-view-toggle,
  .pp-budget-overview-section,
  #archiveContent,
  #activityLogContent,
  #userMgmtContent {
    display: none !important;
  }
}

/* --- Responsive User Form --- */
@media (max-width: 600px) {
  .pp-user-add-grid {
    grid-template-columns: 1fr;
  }

  .pp-user-card-meta {
    flex-wrap: wrap;
  }
}

/* ===========================
   User Management View Styles
   =========================== */

/* --- User table --- */
.um-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.um-table-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.um-table-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.um-table-avatar-initial {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary-50);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.um-user-name {
  font-weight: 500;
  color: var(--color-secondary);
  white-space: nowrap;
}

.um-row-disabled {
  opacity: 0.55;
}

.um-row-disabled td {
  text-decoration: line-through;
  text-decoration-color: var(--color-text-muted);
}

.um-row-disabled .um-user-cell,
.um-row-disabled .um-actions,
.um-row-disabled .pp-access-badge,
.um-row-disabled .status-badge {
  text-decoration: none;
}

/* --- Action buttons --- */
.um-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.um-actions .btn {
  padding: 5px 8px;
  min-width: unset;
  line-height: 1;
}

.um-actions .btn svg {
  display: block;
}

.btn-danger {
  color: #fff !important;
  background: var(--color-danger) !important;
  border-color: var(--color-danger) !important;
}

.btn-danger:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
}

.btn-danger.btn-xs {
  color: var(--color-danger) !important;
  background: transparent !important;
  border: 1px solid var(--color-danger-light) !important;
}

.btn-danger.btn-xs:hover {
  background: var(--color-danger-light) !important;
}

/* --- Reassign info in confirm modal --- */
.um-reassign-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-warning);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.um-reassign-warning svg {
  flex-shrink: 0;
  stroke: var(--color-warning);
}

.pp-reassign-info {
  background: var(--color-warning-light);
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 12px;
}

.um-reassign-list {
  list-style: disc;
  padding-left: 20px;
  margin: 6px 0 0 0;
  font-size: 0.85rem;
  color: var(--color-text);
}

.um-reassign-list li {
  padding: 2px 0;
}

.um-reassign-list em {
  color: var(--color-text-muted);
  font-style: italic;
}

/* --- Sidebar admin section --- */
.sidebar-section-admin .sidebar-section-title {
  color: var(--color-primary);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* --- Responsive user management --- */
@media (max-width: 768px) {
  #umUsersTable th:nth-child(4),
  #umUsersTable td:nth-child(4),
  #umUsersTable th:nth-child(5),
  #umUsersTable td:nth-child(5) {
    display: none;
  }
}

@media (max-width: 600px) {
  #umUsersTable th:nth-child(7),
  #umUsersTable td:nth-child(7) {
    display: none;
  }
}

/* ========== LOGOUT BUTTON ========== */

/* Sidebar logout button */
.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.sidebar-logout-btn svg {
  flex-shrink: 0;
}

/* Header logout button */
.header-logout-btn {
  color: var(--color-text-muted) !important;
}

.header-logout-btn:hover {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

/* ========== PROJECT COUNT TOOLTIP ========== */

.um-project-count {
  display: inline-block;
  padding: 2px 10px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.um-project-count:hover {
  background: var(--color-primary);
  color: #fff;
}

.um-project-count-zero {
  display: inline-block;
  padding: 2px 10px;
  color: var(--color-text-muted);
}

.um-project-tooltip {
  position: fixed;
  z-index: 10000;
  background: var(--color-card-bg, #fff);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 12px 16px;
  min-width: 200px;
  max-width: 340px;
  pointer-events: none;
  animation: umTooltipIn 0.15s ease-out;
}

@keyframes umTooltipIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.um-project-tooltip-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

.um-project-tooltip-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
  font-size: 0.85rem;
}

.um-project-tooltip-name {
  color: var(--color-text);
  font-weight: 500;
}

.um-project-tooltip-role {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 8px;
}

.um-tooltip-role-owner {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

.um-tooltip-role-assigned {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

/* ========== MODULE COUNT BADGE & TOOLTIP ========== */

.um-module-count {
  display: inline-block;
  padding: 2px 10px;
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.um-module-count:hover {
  background: #8b5cf6;
  color: #fff;
}

.um-module-count-zero {
  display: inline-block;
  padding: 2px 10px;
  color: var(--color-text-muted);
}

/* ========== SORTABLE TABLE HEADERS ========== */

.um-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.2s;
}

.um-sortable:hover {
  color: var(--color-primary);
}

.um-sortable.um-sorted {
  color: var(--color-primary);
}

.um-sort-icon {
  font-size: 0.7em;
  color: var(--color-primary);
}

/* ========== ACTIVITY LOG FILTER BAR ========== */

.pp-log-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.pp-log-filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  background: #fff;
  color: var(--color-text-light);
  font-size: 0.813rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.pp-log-filter-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.pp-log-filter-tab:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-50);
}

.pp-log-filter-tab.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.pp-log-filter-tab.active svg {
  stroke: #fff;
}

.pp-log-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 0.688rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.08);
}

.pp-log-filter-tab.active .pp-log-filter-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Module badges in activity log table */
.pp-log-module-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.688rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.pp-log-module-badge.module-projects {
  background: #ede9fe;
  color: #6d28d9;
}

.pp-log-module-badge.module-users {
  background: #dbeafe;
  color: #1d4ed8;
}

.pp-log-module-badge.module-system {
  background: #f0fdf4;
  color: #15803d;
}

.pp-log-module-badge.module-inventory {
  background: #fef3c7;
  color: #92400e;
}

@media (max-width: 768px) {
  .pp-log-filter-bar {
    gap: 6px;
  }
  .pp-log-filter-tab {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
  .pp-login-modal {
    padding: 28px 20px 24px;
    margin: 0 16px;
  }
  .pp-login-logo {
    width: 56px;
    height: 56px;
  }
}

/* ========== USER ARCHIVE STYLES ========== */

.ua-delete-warning-icon {
  text-align: center;
  margin-bottom: 8px;
}
.ua-delete-warning-icon svg {
  color: var(--color-warning, #f59e0b);
}
.ua-delete-final-icon svg {
  color: var(--color-danger, #ef4444);
}

.um-session-modal {
  max-width: 540px;
}

.um-timeout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.um-timeout-grid label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 6px;
}

.um-timeout-preview {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
  font-size: 0.813rem;
  color: var(--color-text-light);
}

.um-archive-modal {
  width: min(96vw, 1240px);
  max-width: 1240px;
  padding: 24px;
  max-height: 92vh;
}

.um-archive-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.um-archive-total {
  min-width: 140px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  padding: 10px 12px;
  text-align: center;
}

.um-archive-total span {
  display: block;
  font-size: 1.4rem;
  color: var(--color-warning);
  font-weight: 700;
  line-height: 1.1;
}

.um-archive-total small {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#uaModalRecoveryAnchor .card {
  margin-top: 14px;
}

#uaModalRecoveryAnchor .pp-table-wrap {
  overflow-x: auto;
}

/* ========== ENHANCED MOBILE RESPONSIVE ========== */

@media (max-width: 768px) {
  /* View toggle buttons: full width */
  .pp-view-toggle {
    width: 100%;
    display: flex;
  }

  .pp-view-toggle .pp-view-btn {
    flex: 1;
    justify-content: center;
  }

  /* Table: smaller fonts and padding for data tables */
  .pp-table-card .data-table th,
  .pp-table-card .data-table td {
    padding: 8px 8px;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .pp-table-card .table-wrapper {
    -webkit-overflow-scrolling: touch;
  }

  /* Project roadmap cards */
  .pp-roadmap-card {
    padding: 12px;
  }

  .pp-roadmap-card h4 {
    font-size: 0.813rem;
  }

  /* Budget section */
  .pp-budget-overview-section .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Admin manage buttons */
  .pp-admin-manage-btns {
    width: 100%;
    justify-content: flex-start;
  }

  /* Task items */
  .pp-task-item {
    flex-wrap: wrap;
    gap: 6px;
  }

  .pp-task-actions {
    width: 100%;
    justify-content: flex-end;
  }

  /* Milestone items */
  .pp-milestone-item {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Detail actions bar */
  .pp-detail-actions-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .pp-detail-actions-bar .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  /* Section headers */
  .pp-section-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Login modal: ensure text centering */
  .pp-login-modal .pp-form-actions {
    text-align: center;
  }

  .pp-login-modal .btn-primary {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Users modal */
  .pp-users-modal-wide {
    max-width: 95vw;
  }

  .pp-user-add-grid {
    grid-template-columns: 1fr;
  }

  .um-timeout-grid {
    grid-template-columns: 1fr;
  }

  .um-archive-modal {
    width: 96vw;
    padding: 16px;
  }

  .um-archive-modal-header {
    flex-direction: column;
    align-items: stretch;
  }

  .um-archive-total {
    width: 100%;
  }
}

@media (max-width: 480px) {
  /* Login modal: even smaller */
  .pp-login-modal {
    padding: 24px 16px 20px;
    margin: 0 10px;
  }

  .pp-login-logo {
    width: 48px;
    height: 48px;
  }

  .pp-login-brand-name {
    font-size: 1.25rem;
  }

  .pp-login-modal h3 {
    font-size: 1rem;
  }

  /* Detail modal: tighter padding */
  .pp-detail-header {
    padding: 16px 14px 12px;
  }

  .pp-detail-body {
    padding: 14px;
  }

  .pp-detail-meta-grid {
    gap: 10px;
  }

  /* Page header */
  .pp-page-header-text h1 {
    font-size: 1.25rem;
  }

  .pp-page-header-text p {
    font-size: 0.75rem;
  }

  /* Stat cards */
  .stat-card-clickable {
    cursor: pointer;
  }

  /* Toolbar buttons: icons only on very small screens */
  .pp-toolbar-right .btn {
    padding: 6px 8px;
  }

  /* Log filter tabs */
  .pp-log-filter-tab {
    padding: 5px 8px;
    font-size: 0.688rem;
  }

  .pp-log-filter-tab svg {
    width: 12px;
    height: 12px;
  }

  .pp-log-filter-count {
    font-size: 0.625rem;
    padding: 1px 5px;
  }
}

/* ===========================
   Form Templates Section
   =========================== */

/* Template Cards Grid */
.ft-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.ft-template-card {
  background: #fff;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.ft-template-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border-color: var(--color-primary, #3b82f6);
}

.ft-template-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--color-primary-light, #eff6ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary, #3b82f6);
}

.ft-template-card-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-secondary, #1e293b);
  margin-bottom: 4px;
}

.ft-template-card-info p {
  font-size: 0.85rem;
  color: var(--color-text-light, #64748b);
  line-height: 1.5;
  margin-bottom: 8px;
}

.ft-template-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  color: var(--color-text-light, #64748b);
}

.ft-template-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--color-bg, #f8fafc);
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 500;
}

.ft-edit-btn {
  align-self: flex-start;
}

/* Editor Header */
.ft-editor-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.ft-editor-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-secondary, #1e293b);
  margin: 0;
}

.ft-editor-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

/* Fields Table */
.ft-fields-card {
  margin-bottom: 20px;
  overflow-x: auto;
}

.ft-fields-card .data-table {
  min-width: 700px;
}

.ft-fields-card .data-table th,
.ft-fields-card .data-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.ft-inline-input,
.ft-inline-select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.2s;
}

.ft-inline-input:focus,
.ft-inline-select:focus {
  outline: none;
  border-color: var(--color-primary, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

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

/* Toggle Switch */
.ft-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

.ft-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ft-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #d1d5db;
  border-radius: 20px;
  transition: background 0.2s;
}

.ft-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.ft-toggle input:checked + .ft-toggle-slider {
  background: var(--color-primary, #3b82f6);
}

.ft-toggle input:checked + .ft-toggle-slider::before {
  transform: translateX(16px);
}

/* Drag Handle */
.ft-drag-handle {
  cursor: grab;
  color: #9ca3af;
  text-align: center;
}

.ft-drag-handle:active {
  cursor: grabbing;
}

.ft-field-row {
  transition: background 0.15s;
}

.ft-field-row.ft-dragging {
  opacity: 0.5;
}

.ft-field-row.ft-drag-over {
  background: var(--color-primary-light, #eff6ff);
}

/* Remove Button */
.ft-remove-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s;
}

.ft-remove-btn:hover {
  background: #fef2f2;
}

/* Editor Actions */
.ft-editor-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 28px;
}

/* Preview Section */
.ft-preview-section {
  margin-top: 8px;
}

.ft-preview-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-secondary, #1e293b);
  margin-bottom: 16px;
}

.ft-preview-container {
  background: #fff;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  padding: 24px;
}

.ft-preview-container .inv-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ft-preview-container .inv-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ft-preview-container .inv-form-group.full-width {
  grid-column: 1 / -1;
}

.ft-preview-container label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-secondary, #1e293b);
}

.ft-preview-container .required {
  color: #ef4444;
}

.ft-preview-container input,
.ft-preview-container select,
.ft-preview-container textarea {
  padding: 8px 12px;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  background: #f9fafb;
  color: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
  .ft-templates-grid {
    grid-template-columns: 1fr;
  }

  .ft-editor-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .ft-editor-toolbar {
    flex-wrap: wrap;
  }

  .ft-preview-container .inv-form-grid {
    grid-template-columns: 1fr;
  }

  .ft-editor-actions {
    flex-direction: column;
  }
}

/* Template Card Actions Row */
.ft-template-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Outline Button Style */
.btn-outline {
  background: #fff;
  color: var(--color-primary, #3b82f6);
  border: 1px solid var(--color-primary, #3b82f6);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-outline:hover {
  background: var(--color-primary-light, #eff6ff);
}

/* ========== FORM PREVIEW MODAL ========== */
.ft-preview-modal-overlay {
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
}

.ft-preview-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.ft-preview-modal {
  background: #fff;
  border-radius: 14px;
  width: 95vw;
  max-width: 860px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  overflow: hidden;
}

.ft-preview-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  background: var(--color-bg, #f8fafc);
  flex-shrink: 0;
}

.ft-preview-modal-toolbar-left h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-secondary, #1e293b);
  margin: 0;
}

.ft-preview-modal-toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ft-preview-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-light, #64748b);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.ft-preview-modal-close:hover {
  background: #fee2e2;
  color: #ef4444;
}

.ft-preview-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  background: #e8eaed;
  display: flex;
  justify-content: center;
}

/* The "page" that looks like a document/PDF */
.ft-preview-page {
  background: #fff;
  width: 100%;
  max-width: 750px;
  min-height: 700px;
  padding: 48px 48px 36px;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  position: relative;
}

/* Logo Wrapper */
.ft-preview-logo-wrapper {
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ft-preview-logo-wrapper[data-position="left"] {
  align-items: flex-start;
}

.ft-preview-logo-wrapper[data-position="right"] {
  align-items: flex-end;
}

.ft-preview-logo-wrapper:hover {
  background: #f1f5f9;
}

.ft-preview-logo-wrapper:hover .ft-preview-logo-actions,
.ft-preview-logo-wrapper:hover .ft-preview-logo-hint {
  opacity: 1;
}

.ft-preview-logo {
  height: 56px;
  width: auto;
  object-fit: contain;
  user-select: none;
}

.ft-preview-logo-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.ft-preview-logo-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--color-border, #e5e7eb);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light, #64748b);
  transition: background 0.15s, color 0.15s;
}

.ft-preview-logo-btn:hover {
  background: var(--color-primary, #3b82f6);
  color: #fff;
  border-color: var(--color-primary, #3b82f6);
}

.ft-preview-logo-hint {
  font-size: 0.7rem;
  color: var(--color-text-light, #94a3b8);
  opacity: 0;
  transition: opacity 0.2s;
  margin-top: 4px;
}

/* Editable Title / Subtitle */
.ft-preview-form-title {
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  color: var(--color-secondary, #1e293b);
  margin: 8px 0 4px;
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
  transition: background 0.2s;
  cursor: text;
}

.ft-preview-form-title:hover,
.ft-preview-form-title:focus {
  background: #f1f5f9;
}

.ft-preview-form-title:focus {
  box-shadow: 0 0 0 2px var(--color-primary, #3b82f6);
}

.ft-preview-form-subtitle {
  font-size: 0.88rem;
  text-align: center;
  color: var(--color-text-light, #64748b);
  margin-bottom: 16px;
  padding: 3px 8px;
  border-radius: 6px;
  outline: none;
  transition: background 0.2s;
  cursor: text;
}

.ft-preview-form-subtitle:hover,
.ft-preview-form-subtitle:focus {
  background: #f1f5f9;
}

.ft-preview-form-subtitle:focus {
  box-shadow: 0 0 0 2px var(--color-primary, #3b82f6);
}

.ft-preview-divider {
  border: none;
  border-top: 1.5px solid var(--color-border, #e5e7eb);
  margin: 16px 0;
}

/* Preview form fields grid */
.ft-pv-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ft-pv-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ft-pv-field.ft-pv-full {
  grid-column: 1 / -1;
}

.ft-pv-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-light, #475569);
  padding: 2px 4px;
  border-radius: 4px;
  outline: none;
  cursor: text;
  transition: background 0.15s;
}

.ft-pv-label:hover {
  background: #fef9c3;
}

.ft-pv-label:focus {
  background: #fef9c3;
  box-shadow: 0 0 0 2px #eab308;
}

.ft-pv-label .required {
  color: var(--color-danger, #ef4444);
}

.ft-pv-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: inherit;
  background: #fafafa;
  color: var(--color-text, #334155);
  box-sizing: border-box;
}

.ft-pv-input:disabled {
  background: #fafafa;
  cursor: default;
}

textarea.ft-pv-input {
  resize: vertical;
  min-height: 50px;
}

/* Footer editable */
.ft-preview-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-light, #94a3b8);
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
  transition: background 0.2s;
  cursor: text;
  margin-top: 8px;
}

.ft-preview-footer:hover,
.ft-preview-footer:focus {
  background: #f1f5f9;
}

.ft-preview-footer:focus {
  box-shadow: 0 0 0 2px var(--color-primary, #3b82f6);
}

/* Responsive preview */
@media (max-width: 640px) {
  .ft-preview-modal-body {
    padding: 16px;
  }

  .ft-preview-page {
    padding: 28px 20px 24px;
  }

  .ft-pv-form-grid {
    grid-template-columns: 1fr;
  }

  .ft-preview-modal-toolbar {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .ft-preview-modal-toolbar-right {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ========== ASSET NOTE DESIGNER ========== */

.an-designer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}
.an-designer-overlay.active {
  display: flex;
}

.an-designer {
  background: #f1f5f9;
  border-radius: 12px;
  width: 95vw;
  max-width: 1000px;
  height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
}

.an-designer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.an-designer-toolbar-left h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}
.an-designer-hint {
  font-size: 11px;
  color: #94a3b8;
  margin: 0;
}
.an-designer-instructions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.an-designer-vars-hint {
  font-size: 11px;
  color: #64748b;
  margin: 0;
}
.an-designer-vars-hint strong {
  color: #2563eb;
}

.an-designer-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.an-undo-redo-group {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 2px;
  background: #f8fafc;
}
.an-undo-redo-group .btn {
  border: none;
  background: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}
.an-undo-redo-group .btn:not(:disabled):hover {
  background: #e2e8f0;
}
.an-undo-redo-group .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.an-designer-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: #64748b;
  display: flex;
  align-items: center;
}
.an-designer-close:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.an-designer-body {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
  display: flex;
  justify-content: center;
}

/* A4 page canvas */
.an-page {
  background: #fff;
  width: 210mm;
  min-height: 297mm;
  padding: 12mm 15mm;
  box-shadow: 0 2px 20px rgba(0,0,0,0.12);
  border: 1px solid #e2e8f0;
  font-family: Helvetica, Arial, sans-serif;
  position: relative;
}

/* Sections */
.an-section {
  position: relative;
  margin-bottom: 6px;
  border: 1px dashed transparent;
  border-radius: 3px;
  padding: 2px;
  transition: border-color 0.15s, background 0.15s;
  cursor: grab;
}
.an-section:hover {
  border-color: #93c5fd;
  background: rgba(59,130,246,0.03);
}
.an-section.an-dragging {
  opacity: 0.4;
  border-color: #3b82f6;
}
.an-section.an-drag-over {
  border-color: #3b82f6;
  background: rgba(59,130,246,0.08);
}

/* Editable elements */
.an-editable {
  outline: none;
  cursor: text;
  border-radius: 2px;
  transition: background 0.15s;
}
.an-editable:hover {
  background: rgba(250,204,21,0.15);
}
.an-editable:focus {
  background: rgba(250,204,21,0.25);
  box-shadow: 0 0 0 2px rgba(250,204,21,0.4);
}

/* Logo section */
.an-logo-section {
  margin-bottom: 4px;
}
.an-logo-wrapper {
  display: inline-block;
  position: relative;
}
.an-logo-img {
  width: auto;
  max-width: 100%;
}
.an-logo-controls {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 3px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 10;
}
.an-logo-wrapper:hover .an-logo-controls {
  display: flex;
}
.an-ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.an-ctrl-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* Header section */
.an-header-section {
  text-align: center;
}

/* Info table */
.an-info-table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
}
.an-info-table td.an-info-cell {
  border: 1px solid #000;
  padding: 4px 6px;
  font-size: 9px;
  width: 48%;
}
.an-info-label {
  font-weight: 700;
}
.an-info-value {
  color: #64748b;
  font-style: italic;
  margin-left: 4px;
  font-size: 8px;
}
.an-info-actions {
  width: 28px;
  text-align: center;
  border: none !important;
  padding: 0 2px;
}
.an-row-del-btn {
  display: none;
  width: 22px;
  height: 22px;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  background: #fff;
  color: #ef4444;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.an-info-row:hover .an-row-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.an-row-del-btn:hover {
  background: #fef2f2;
}

/* Items table */
.an-items-table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
}
.an-items-table thead th {
  background: #2c3e50;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  padding: 4px 6px;
  text-align: center;
  border: 1px solid #2c3e50;
}
.an-items-table thead th.an-editable:hover {
  background: #34495e;
}
.an-items-table thead th.an-editable:focus {
  background: #34495e;
  box-shadow: inset 0 0 0 2px rgba(250,204,21,0.5);
}
.an-items-table td {
  border: 1px solid #000;
  padding: 3px 6px;
  font-size: 8px;
  vertical-align: top;
}
.an-sample-row td {
  min-height: 16px;
}
.an-empty-row td {
  height: 10mm;
}
.an-col-actions {
  width: 24px;
  border: none !important;
  background: transparent !important;
  text-align: center;
  padding: 0 !important;
}
.an-col-add-btn {
  width: 22px;
  height: 22px;
  border: 1px dashed #93c5fd;
  border-radius: 4px;
  background: #fff;
  color: #3b82f6;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.an-col-add-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
}

/* Add line / control buttons */
.an-add-line-btn {
  display: block;
  margin: 4px auto 0;
  background: none;
  border: 1px dashed #93c5fd;
  color: #3b82f6;
  font-size: 11px;
  padding: 3px 14px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.an-section:hover .an-add-line-btn,
.an-items-controls:hover .an-add-line-btn {
  opacity: 1;
}
.an-add-line-btn:hover {
  background: #eff6ff;
}
.an-remove-row-btn {
  border-color: #fca5a5;
  color: #ef4444;
}
.an-remove-row-btn:hover {
  background: #fef2f2;
}

.an-items-controls {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 4px;
}
.an-items-controls .an-add-line-btn {
  opacity: 0;
}
.an-items-section:hover .an-items-controls .an-add-line-btn {
  opacity: 1;
}

/* Disclaimer */
.an-disclaimer-section {
  margin-top: 4px;
}

/* Comment section */
.an-comment-section {
  position: relative;
}
.an-comment-box {
  border: 1px solid #000;
  min-height: 20mm;
  margin: 3px 0 0;
  border-radius: 0;
  padding: 4px;
  position: relative;
}
.an-section-toggle {
  position: absolute;
  top: 2px;
  right: 2px;
  display: none;
  background: #fff;
  border: 1px solid #fca5a5;
  color: #ef4444;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.an-comment-section:hover .an-section-toggle {
  display: block;
}
.an-section-toggle:hover {
  background: #fef2f2;
}

.an-comment-hidden {
  text-align: center;
  padding: 4px;
}

/* Signatures */
.an-signatures-grid {
  display: flex;
  gap: 8px;
}
.an-signature-block {
  flex: 1;
  position: relative;
  padding: 4px;
  border: 1px dashed transparent;
  border-radius: 3px;
  transition: border-color 0.15s;
}
.an-signature-block:hover {
  border-color: #93c5fd;
}
.an-sig-title {
  font-size: 9px;
  font-weight: 700;
}
.an-sig-name {
  font-size: 8px;
  margin-top: 10px;
  min-height: 14px;
}
.an-sig-line {
  border-bottom: 1px solid #000;
  margin: 2px 0 3px;
  width: 85%;
}
.an-sig-subtitle {
  font-size: 8px;
}
.an-sig-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  display: none;
  width: 20px;
  height: 20px;
  background: #fff;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  color: #ef4444;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  text-align: center;
}
.an-signature-block:hover .an-sig-remove {
  display: flex;
  align-items: center;
  justify-content: center;
}
.an-sig-remove:hover {
  background: #fef2f2;
}

/* Footer */
.an-footer-section {
  margin-top: 8px;
}

/* Responsive */
@media (max-width: 800px) {
  .an-designer {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    max-width: none;
  }
  .an-designer-body {
    padding: 10px;
  }
  .an-page {
    width: 100%;
    min-height: auto;
    padding: 8mm;
  }
  .an-designer-toolbar {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  .an-designer-toolbar-right {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .an-designer-instructions {
    padding: 6px 12px;
  }
  .an-vars-panel {
    width: 140px;
    min-width: 140px;
  }
}

/* === Variable Picker === */
.an-var-btn {
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px dashed transparent;
  transition: all 0.15s;
}
.an-var-btn:hover {
  background: rgba(59,130,246,0.12);
  border-color: #3b82f6;
  color: #2563eb;
}
.an-var-picker {
  position: absolute;
  z-index: 100;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  width: 220px;
  max-height: 300px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.an-var-picker-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.an-var-picker-list {
  overflow-y: auto;
  max-height: 260px;
}
.an-var-option {
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: background 0.1s;
  border-bottom: 1px solid #f1f5f9;
}
.an-var-option:hover {
  background: #eff6ff;
}
.an-var-option.an-var-selected {
  background: #dbeafe;
}
.an-var-key {
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  font-family: monospace;
}
.an-var-label {
  font-size: 11px;
  font-weight: 600;
  color: #1e293b;
}
.an-var-desc {
  font-size: 10px;
  color: #94a3b8;
}

/* === Signature Variable Support === */
.an-sig-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  min-height: 14px;
}
.an-sig-name-row .an-sig-name {
  flex: 1;
  margin-top: 0;
  min-height: 14px;
}
.an-sig-name-row .an-sig-var-btn {
  font-size: 8px;
  font-family: monospace;
  color: #2563eb;
  background: rgba(59,130,246,0.08);
  border: 1px dashed #93c5fd;
  border-radius: 3px;
  padding: 1px 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.an-sig-name-row .an-sig-var-btn:hover {
  background: rgba(59,130,246,0.18);
  border-color: #3b82f6;
}
.an-sig-set-var {
  display: none;
  width: 22px;
  height: 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  color: #64748b;
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: all 0.15s;
}
.an-signature-block:hover .an-sig-set-var {
  display: flex;
  align-items: center;
  justify-content: center;
}
.an-sig-set-var:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #2563eb;
}
.an-sig-clear-var {
  width: 18px;
  height: 18px;
  background: #fff;
  border: 1px solid #fca5a5;
  border-radius: 3px;
  color: #ef4444;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.an-sig-clear-var:hover {
  background: #fef2f2;
}

/* === Draggable Variables Panel === */
.an-vars-panel {
  display: none;
  flex-direction: column;
  width: 180px;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  max-height: calc(100vh - 120px);
  align-self: flex-start;
  position: sticky;
  top: 10px;
}
.an-vars-panel-header {
  padding: 8px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.an-vars-panel-header span:first-child {
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
}
.an-vars-panel-hint {
  font-size: 9px;
  color: #94a3b8;
}
.an-vars-panel-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}
.an-vars-panel-item {
  display: flex;
  flex-direction: column;
  padding: 5px 10px;
  cursor: grab;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
  user-select: none;
}
.an-vars-panel-item:hover {
  background: #eff6ff;
}
.an-vars-panel-item.dragging {
  opacity: 0.5;
  background: #dbeafe;
}
.an-vars-panel-tag {
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  font-family: monospace;
}
.an-vars-panel-label {
  font-size: 10px;
  color: #64748b;
}
/* Drag over highlight for drop targets */
.an-drag-over {
  outline: 2px dashed #3b82f6 !important;
  outline-offset: 1px;
  background: rgba(59,130,246,0.06) !important;
}
/* Active state for the variables toggle button */
#anToggleVarsPanel.active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #2563eb;
}
/* Designer body layout to accommodate panel */
.an-designer-body {
  justify-content: center;
  gap: 12px;
  align-items: flex-start;
}
.an-designer-body .an-page {
  flex: none;
}

/* === Design Tools Dropdown === */
.an-tools-dropdown {
  position: relative;
}
.an-tools-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  min-width: 180px;
  z-index: 100;
  overflow: hidden;
}
.an-tools-menu.active {
  display: block;
}
.an-tools-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  color: #1e293b;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.an-tools-item:hover {
  background: #f1f5f9;
}
.an-tools-item svg {
  flex-shrink: 0;
  color: #64748b;
}

/* === Custom Elements === */
.an-custom-section {
  position: relative;
}
.an-custom-controls {
  position: absolute;
  top: -2px;
  right: 2px;
  display: none;
  gap: 3px;
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 10;
}
.an-custom-section:hover .an-custom-controls {
  display: flex;
}
.an-custom-ctrl {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.an-custom-ctrl:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.an-custom-del {
  color: #ef4444;
  border-color: #fca5a5;
  font-size: 16px;
}
.an-custom-del:hover {
  background: #fef2f2;
}
.an-custom-size,
.an-line-style,
.an-line-thickness,
.an-box-height,
.an-spacing-height {
  height: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 10px;
  color: #475569;
  background: #fff;
  padding: 0 4px;
  cursor: pointer;
}

/* Custom text field */
.an-custom-text-content {
  min-height: 16px;
  padding: 2px 4px;
}

/* Custom horizontal line */
.an-hr {
  border: none;
  margin: 4px 0;
}

/* Custom box */
.an-box-container {
  border-radius: 2px;
}
.an-box-label {
  min-height: 12px;
}
.an-box-content {
  min-height: 12mm;
}

/* Custom spacing */
.an-spacing-block {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    rgba(148,163,184,0.1) 4px,
    rgba(148,163,184,0.1) 8px
  );
  border: 1px dashed #cbd5e1;
  border-radius: 2px;
  position: relative;
}
.an-spacing-block::after {
  content: 'spacing';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  font-size: 9px;
  color: #94a3b8;
  pointer-events: none;
}

/* Custom variable element */
.an-custom-variable {
  position: relative;
}
.an-custom-var-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  min-height: 20px;
  border: 1px dashed #a5b4fc;
  border-radius: 4px;
  background: #f0f4ff;
}
.an-custom-var-label {
  min-width: 30px;
  padding: 1px 4px;
  border-radius: 2px;
  outline: none;
  cursor: text;
}
.an-custom-var-label:focus {
  background: #fff;
  box-shadow: 0 0 0 2px #818cf8;
}
.an-custom-var-value {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  font-family: monospace;
  font-size: 0.85em;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #c7d2fe;
  transition: background 0.15s, border-color 0.15s;
}
.an-custom-var-value:hover {
  background: #c7d2fe;
  border-color: #818cf8;
}

/* Logo size selector */
.an-logo-size {
  height: 24px;
  font-size: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  padding: 0 2px;
  cursor: pointer;
}
.an-logo-size:hover {
  border-color: #94a3b8;
}

/* Cell extras (text/variables inside info table cells) */
.an-cell-extra {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  padding: 2px 4px;
  border-radius: 3px;
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
  position: relative;
}
.an-cell-extra:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.an-cell-extra-content {
  flex: 1;
  min-width: 30px;
}
.an-cell-extra-label {
  font-weight: 600;
}
.an-cell-extra-del {
  display: none;
  width: 16px;
  height: 16px;
  border: none;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.an-cell-extra:hover .an-cell-extra-del {
  display: flex;
  align-items: center;
  justify-content: center;
}
.an-cell-var-btn {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  font-family: monospace;
  font-size: 0.8em;
  padding: 1px 6px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid #c7d2fe;
}
.an-cell-var-btn:hover {
  background: #c7d2fe;
  border-color: #818cf8;
}
.an-cell-add-btns {
  display: none;
  gap: 3px;
  margin-top: 3px;
}
.an-info-cell:hover .an-cell-add-btns {
  display: flex;
}
.an-cell-add-btn {
  font-size: 9px;
  padding: 1px 6px;
  border: 1px dashed #cbd5e1;
  border-radius: 3px;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  font-weight: 600;
}
.an-cell-add-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #334155;
}

/* Box children (text/variables inside box containers) */
.an-box-child {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 3px 6px;
  border-radius: 3px;
  background: #fefce8;
  border: 1px dashed #e5e7eb;
  position: relative;
}
.an-box-child:hover {
  background: #fef9c3;
  border-color: #94a3b8;
}
.an-box-child-content {
  flex: 1;
  min-width: 30px;
}
.an-box-child-label {
  font-weight: 600;
}
.an-box-child-del {
  display: none;
  width: 16px;
  height: 16px;
  border: none;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.an-box-child:hover .an-box-child-del {
  display: flex;
  align-items: center;
  justify-content: center;
}
.an-box-var-btn {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  font-family: monospace;
  font-size: 0.8em;
  padding: 1px 6px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid #c7d2fe;
}
.an-box-var-btn:hover {
  background: #c7d2fe;
  border-color: #818cf8;
}
.an-box-add-btns {
  display: none;
  gap: 4px;
  margin-top: 4px;
}
.an-box-container:hover .an-box-add-btns {
  display: flex;
}
.an-box-add-btn {
  font-size: 9px;
  padding: 2px 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 3px;
  background: #fffbeb;
  color: #92400e;
  cursor: pointer;
  font-weight: 600;
}
.an-box-add-btn:hover {
  background: #fef3c7;
  border-color: #d97706;
  color: #78350f;
}

/* Comment extras (text/variables inside employee comment section) */
.an-comment-extra {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  margin-bottom: 3px;
  padding: 2px 4px;
  border-radius: 3px;
  background: #fef3c7;
  border: 1px dashed #fbbf24;
  position: relative;
}
.an-comment-extra:hover {
  background: #fde68a;
  border-color: #f59e0b;
}
.an-comment-extra-content {
  flex: 1;
  min-width: 30px;
}
.an-comment-extra-label {
  font-weight: 600;
}
.an-comment-extra-del {
  display: none;
  width: 16px;
  height: 16px;
  border: none;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.an-comment-extra:hover .an-comment-extra-del {
  display: flex;
  align-items: center;
  justify-content: center;
}
.an-comment-var-btn {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  font-family: monospace;
  font-size: 0.8em;
  padding: 1px 6px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid #c7d2fe;
}
.an-comment-var-btn:hover {
  background: #c7d2fe;
  border-color: #818cf8;
}
.an-comment-add-btns {
  display: none;
  gap: 3px;
  margin-top: 4px;
}
.an-comment-box:hover .an-comment-add-btns {
  display: flex;
}
.an-comment-add-btn {
  font-size: 9px;
  padding: 1px 6px;
  border: 1px dashed #fbbf24;
  border-radius: 3px;
  background: #fffbeb;
  color: #92400e;
  cursor: pointer;
  font-weight: 600;
}
.an-comment-add-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
}

/* Items cell extras (text/variables inside items table cells) */
.an-items-cell {
  position: relative;
}
.an-items-cell-extra {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  padding: 2px 4px;
  border-radius: 3px;
  background: #ecfdf5;
  border: 1px dashed #6ee7b7;
  position: relative;
}
.an-items-cell-extra:hover {
  background: #d1fae5;
  border-color: #34d399;
}
.an-items-cell-extra-content {
  flex: 1;
  min-width: 30px;
}
.an-items-cell-extra-label {
  font-weight: 600;
}
.an-items-cell-extra-del {
  display: none;
  width: 16px;
  height: 16px;
  border: none;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.an-items-cell-extra:hover .an-items-cell-extra-del {
  display: flex;
  align-items: center;
  justify-content: center;
}
.an-items-cell-var-btn {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  font-family: monospace;
  font-size: 0.8em;
  padding: 1px 6px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid #c7d2fe;
}
.an-items-cell-var-btn:hover {
  background: #c7d2fe;
  border-color: #818cf8;
}
.an-items-cell-add-btns {
  display: none;
  gap: 3px;
  margin-top: 3px;
}
.an-items-cell:hover .an-items-cell-add-btns {
  display: flex;
}
.an-items-cell-add-btn {
  font-size: 9px;
  padding: 1px 6px;
  border: 1px dashed #6ee7b7;
  border-radius: 3px;
  background: #ecfdf5;
  color: #065f46;
  cursor: pointer;
  font-weight: 600;
}
.an-items-cell-add-btn:hover {
  background: #d1fae5;
  border-color: #34d399;
  color: #064e3b;
}

/* Sample row cell content items */
.an-sample-cell {
  position: relative;
  vertical-align: top;
}
.an-sample-cell-item {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: 2px 4px;
  border-radius: 3px;
  background: #eff6ff;
  border: 1px dashed #93c5fd;
  position: relative;
}
.an-sample-cell-item:first-child {
  margin-top: 0;
}
.an-sample-cell-item:hover {
  background: #dbeafe;
  border-color: #3b82f6;
}
.an-sample-cell-item-content {
  flex: 1;
  min-width: 30px;
}
.an-sample-cell-item-label {
  font-weight: 600;
}
.an-sample-cell-item-del {
  display: none;
  width: 16px;
  height: 16px;
  border: none;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.an-sample-cell-item:hover .an-sample-cell-item-del {
  display: flex;
  align-items: center;
  justify-content: center;
}
.an-sample-cell-var-btn {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  font-family: monospace;
  font-size: 0.8em;
  padding: 1px 6px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid #c7d2fe;
}
.an-sample-cell-var-btn:hover {
  background: #c7d2fe;
  border-color: #818cf8;
}
.an-sample-cell-add-btns {
  display: none;
  gap: 3px;
  margin-top: 3px;
}
.an-sample-cell:hover .an-sample-cell-add-btns {
  display: flex;
}
.an-sample-cell-add-btn {
  font-size: 9px;
  padding: 1px 6px;
  border: 1px dashed #93c5fd;
  border-radius: 3px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font-weight: 600;
}
.an-sample-cell-add-btn:hover {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e3a8a;
}

/* Empty row cell extras */
.an-empty-row-cell {
  position: relative;
  vertical-align: top;
}
.an-empty-row-cell-extra {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  padding: 2px 4px;
  border-radius: 3px;
  background: #ecfdf5;
  border: 1px dashed #6ee7b7;
  position: relative;
}
.an-empty-row-cell-extra:hover {
  background: #d1fae5;
  border-color: #34d399;
}
.an-empty-row-cell-extra-del {
  display: none;
  width: 16px;
  height: 16px;
  border: none;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.an-empty-row-cell-extra:hover .an-empty-row-cell-extra-del {
  display: flex;
  align-items: center;
  justify-content: center;
}
.an-empty-row-cell-var-btn {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  font-family: monospace;
  font-size: 0.8em;
  padding: 1px 6px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid #c7d2fe;
}
.an-empty-row-cell-var-btn:hover {
  background: #c7d2fe;
  border-color: #818cf8;
}
.an-empty-row-cell-add-btns {
  display: none;
  gap: 3px;
  margin-top: 3px;
}
.an-empty-row-cell:hover .an-empty-row-cell-add-btns {
  display: flex;
}
.an-empty-row-cell-add-btn {
  font-size: 9px;
  padding: 1px 6px;
  border: 1px dashed #6ee7b7;
  border-radius: 3px;
  background: #ecfdf5;
  color: #065f46;
  cursor: pointer;
  font-weight: 600;
}
.an-empty-row-cell-add-btn:hover {
  background: #d1fae5;
  border-color: #34d399;
  color: #064e3b;
}

/* Visible column delete button in items table headers */
.an-col-del-btn {
  display: none;
  position: absolute;
  top: 1px;
  right: 1px;
  width: 16px;
  height: 16px;
  border: none;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}
.an-items-table thead th {
  position: relative;
}
.an-items-table thead th:hover .an-col-del-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Column width control */
.an-col-width-ctrl {
  display: none;
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}
.an-items-table thead th:hover .an-col-width-ctrl {
  display: block;
}
.an-col-width-select {
  font-size: 9px;
  padding: 1px 2px;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  background: #fff;
  color: #334155;
  cursor: pointer;
}

/* Row height control */
.an-items-row-height-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 10px;
  color: #64748b;
}
.an-items-row-height-ctrl label {
  display: flex;
  align-items: center;
  gap: 4px;
}
.an-row-height-select {
  font-size: 10px;
  padding: 2px 4px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  cursor: pointer;
}

/* Inline items (text + variable on same line) */
.an-item-inline {
  display: inline-flex !important;
  vertical-align: middle;
  margin-right: 4px;
}

/* +T&V button */
.an-sample-cell-add-btn[data-add="textvar"],
.an-empty-row-cell-add-btn[data-add="textvar"] {
  font-size: 9px;
  white-space: nowrap;
}

/* User Role & Permission Modal */
.um-role-modal {
  max-width: 860px;
}

.um-role-create {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}

.um-role-create .pp-category-input {
  flex: 1;
}

.um-role-list-wrap {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.um-role-list-wrap .pp-filter-select {
  flex: 1;
}

.um-role-matrix-wrap {
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.um-role-matrix {
  margin: 0;
}

.um-role-perm-select {
  min-width: 190px;
}

.um-role-name-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.688rem;
  font-weight: 600;
  background: #e0f2fe;
  color: #075985;
}
