@import url('animations.css');
@import url('icons.css');
@import url('cards.css');
@import url('responsive.css');

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition:
    transform 0.25s ease 0.05s,
    box-shadow 0.25s ease 0.05s,
    opacity 0.25s ease 0.05s,
    background 0.25s ease,
    color 0.28s ease 0.06s,
    border-color 0.28s ease 0.06s;
}
.btn:hover {
  transition:
    transform 0.22s ease 0s,
    box-shadow 0.22s ease 0s,
    opacity 0.22s ease 0s,
    background 0.22s ease 0s,
    color 0.22s ease 0s,
    border-color 0.22s ease 0s;
}
.btn-primary {
  background: var(--color-primary);
  color: var(--color-black);
}
a.btn-primary { color: var(--color-black); }
.btn-primary:hover,
.btn-primary:focus-visible,
a.btn-primary:hover,
a.btn-primary:focus-visible {
  color: var(--color-white);
  opacity: 0.95;
}
.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
a.btn-secondary { color: var(--color-primary); }
.btn-secondary:hover,
.btn-secondary:focus-visible,
a.btn-secondary:hover,
a.btn-secondary:focus-visible {
  color: var(--color-paper);
  border-color: var(--color-soft-orange);
}
.btn-ghost { background: transparent; color: var(--color-paper); border: 1px solid var(--color-graphite); }
a.btn-ghost { color: var(--color-paper); }
.btn-ghost:hover,
.btn-ghost:focus-visible,
a.btn-ghost:hover,
a.btn-ghost:focus-visible {
  color: var(--color-white);
  border-color: rgba(242, 147, 47, 0.45);
}
.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-edit {
  background: rgba(52, 152, 219, 0.15);
  color: #5dade2;
  border: 1px solid rgba(52, 152, 219, 0.45);
}
.btn-edit:hover,
a.btn-edit:hover {
  background: rgba(52, 152, 219, 0.28);
  color: var(--color-white);
  border-color: #5dade2;
}
.btn-danger {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.45);
  box-shadow: none;
}
.btn-danger:hover,
.btn-danger:focus-visible {
  background: rgba(231, 76, 60, 0.35);
  color: var(--color-white);
  border-color: #e74c3c;
  box-shadow: none;
}
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
html.modal-open,
body.modal-open {
  overflow: hidden;
  height: 100%;
}
body.modal-open {
  padding-right: var(--modal-scrollbar-width, 0);
  touch-action: none;
}

.money-value {
  display: inline-flex;
  align-items: center;
  gap: var(--money-symbol-gap);
  font-weight: 600;
  line-height: 1.2;
  flex-direction: row;
}
.sar-icon {
  display: inline-block;
  flex-shrink: 0;
  width: 1em;
  height: 1.08em;
  min-width: 0.9em;
  min-height: 0.9em;
  margin: 0;
  background-color: currentColor;
  -webkit-mask-image: url('/assets/images/SAR.webp');
  mask-image: url('/assets/images/SAR.webp');
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  vertical-align: -0.06em;
}

table td .money-value {
  display: inline-flex;
  align-items: center;
  gap: 0.18em;
  white-space: nowrap;
}

table td .money-value .sar-icon,
table td .sar-icon {
  width: 1em;
  height: 1.08em;
  min-width: 14px;
  min-height: 14px;
}
.kpi-card .value .money-value,
.summary-box .amount .money-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-width: 0;
  gap: var(--money-symbol-gap);
  flex-wrap: nowrap;
}
.kpi-card .value .money-amount {
  min-width: 0;
  overflow: visible;
  text-overflow: unset;
  white-space: nowrap;
  font-size: inherit;
  letter-spacing: -0.01em;
}
.kpi-card .value .sar-icon,
.summary-box .amount .sar-icon {
  width: 0.8em;
  height: 0.95em;
  flex-shrink: 0;
  margin: 0;
}
.settings-preview {
  font-size: 14px;
  color: rgba(244, 241, 236, 0.65);
  margin-bottom: var(--space-2);
}
.settings-preview strong { color: var(--color-primary); }

.empty-state {
  text-align: center;
  color: #888;
  padding: var(--space-4);
  font-size: 15px;
}
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: var(--color-graphite);
  border: 1px solid #2a2a30;
  border-radius: var(--radius-md);
}
.filters-bar .input-group { margin-bottom: 0; min-width: 140px; flex: 1; }
.filters-bar .view-toggle {
  flex: 0 0 auto;
  align-self: flex-end;
}
.notif-banner {
  position: fixed;
  top: var(--space-3);
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  background: var(--color-graphite);
  border: 1px solid var(--color-primary);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  z-index: 3000;
  max-width: min(92vw, 520px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.1s;
  text-align: right;
}
.notif-banner.show { transform: translateX(-50%) translateY(0); }
.notif-banner strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-paper);
}
.notif-banner p {
  font-size: 15px;
  line-height: 1.45;
  margin-top: 8px;
  color: #bbb;
}
.chart-wrap {
  position: relative;
  min-height: 260px;
}
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: var(--space-3);
  text-align: center;
  color: rgba(244, 241, 236, 0.5);
  font-size: 15px;
  line-height: 1.65;
  pointer-events: none;
  z-index: 3;
}
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: #1a1a1e;
  border: 1px solid var(--color-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.15s ease 0.05s;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip.pinned {
  opacity: 1;
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.chart-bar-selection {
  margin: 0 0 var(--space-2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(242, 147, 47, 0.1);
  border: 1px solid rgba(242, 147, 47, 0.28);
  color: var(--color-paper);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
.chart-bar-selection .sar-icon {
  display: inline-block;
  width: 0.78em;
  height: 0.95em;
  margin-inline-start: 4px;
  background-color: currentColor;
  -webkit-mask-image: url('/assets/images/SAR.webp');
  mask-image: url('/assets/images/SAR.webp');
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  vertical-align: -0.06em;
}

.input-group { margin-bottom: var(--space-2); }
.input-group label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-transform: none;
  margin-bottom: 6px;
  color: var(--color-soft-orange);
  line-height: 1.45;
}
.input, .select, .textarea {
  width: 100%;
  padding: var(--input-pad-y) var(--input-pad-x);
  background: var(--color-graphite);
  border: 1px solid #2a2a30;
  border-radius: var(--radius-sm);
  color: var(--color-paper);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* تواريخ وأرقام بصيغة إنجليزية — خلفية بيضاء لظهور التقويم بوضوح */
input.date-input-latin,
input.input-latin-num,
input[type="date"] {
  color-scheme: light;
  background-color: #ffffff !important;
  color: #1c1c20 !important;
  border-color: #c8c4bc !important;
  font-variant-numeric: lining-nums tabular-nums;
}
input.date-input-latin::placeholder {
  color: #6b6b6b;
}
input.date-input-latin:focus,
input.input-latin-num:focus {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 2px rgba(242, 147, 47, 0.28);
}
input.date-input-latin::-webkit-calendar-picker-indicator {
  filter: none;
  opacity: 0.9;
  cursor: pointer;
}

.textarea { min-height: 120px; resize: vertical; }

.card {
  background: var(--color-graphite);
  border: 1px solid #2a2a30;
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.card-paper {
  background: var(--color-paper);
  color: var(--color-black);
  border: 1px solid #e0dcd4;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}
.badge-new { background: #4a4a52; color: var(--color-paper); }
.badge-reviewing { background: var(--color-tint); color: var(--color-deep-orange); }
.badge-in_progress { background: var(--color-primary); color: var(--color-black); }
.badge-pending_approval { background: #c9a227; color: var(--color-black); }
.badge-revision { background: var(--color-deep-orange); color: var(--color-white); }
.badge-delayed { background: #c0392b; color: var(--color-white); }
.badge-completed { background: #27ae60; color: var(--color-white); }
.badge-closed { background: #333; color: var(--color-paper); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: var(--space-2);
  text-align: right;
  border-bottom: 1px solid #2a2a30;
}
th { font-weight: 600; font-size: 14px; color: var(--color-soft-orange); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 11, 12, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-3);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.modal-overlay.active {
  display: flex;
  opacity: 1;
}
.modal-overlay--confirm { z-index: 1100; }
.modal {
  background: linear-gradient(165deg, #232328 0%, var(--color-graphite) 55%);
  border: 1px solid rgba(242, 147, 47, 0.18);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  max-width: 560px;
  width: 100%;
  max-height: min(90vh, 720px);
  overflow-y: auto;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  gap: var(--space-2);
}
.modal-header h3 { margin: 0; font-size: 20px; }
.modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid #2a2a30;
  border-radius: var(--radius-sm);
  color: var(--color-paper);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.modal-close:hover {
  background: rgba(231, 76, 60, 0.12);
  border-color: rgba(231, 76, 60, 0.35);
  color: #fff;
}
.confirm-modal {
  max-width: 440px;
  text-align: center;
  padding: var(--space-5) var(--space-4) var(--space-4);
}
.confirm-modal-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.confirm-modal-icon-wrap--danger {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.35);
  box-shadow: 0 0 24px rgba(231, 76, 60, 0.12);
}
.confirm-modal-icon-wrap--info {
  background: rgba(242, 147, 47, 0.12);
  color: var(--color-primary);
  border: 1px solid rgba(242, 147, 47, 0.35);
}
.confirm-modal-body { margin-bottom: var(--space-4); }
.confirm-modal-title {
  margin: 0 0 var(--space-2);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-white);
}
.confirm-modal-message {
  margin: 0;
  color: rgba(244, 241, 236, 0.82);
  line-height: 1.7;
  font-size: 15px;
}
.confirm-modal-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.confirm-modal-actions .btn {
  min-width: 120px;
  padding: 10px 20px;
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

/* نافذة استيراد العملاء */
.modal.modal-import,
#modal-import .modal {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(560px, calc(100vw - 2 * var(--layout-pad-x, 16px)));
}
.modal.modal-import h3,
#modal-import .modal > h3 {
  margin: 0;
  padding-inline-end: 2.5rem;
  line-height: 1.35;
}
.modal.modal-import .modal-close,
#modal-import .modal-close {
  position: absolute;
  top: var(--space-2);
  inset-inline-start: var(--space-2);
}
.modal-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}
.modal-import-actions .btn {
  flex: 1 1 auto;
  min-width: 120px;
}

/* نافذة التصدير */
.modal.modal-export,
.export-modal-overlay .modal {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(400px, calc(100vw - 2 * var(--layout-pad-x, 16px)));
}

.modal.modal-export h3,
.export-modal-overlay .modal > h3 {
  margin: 0;
  padding-inline-end: 2.5rem;
  line-height: 1.35;
}

.modal.modal-export .modal-close,
.export-modal-overlay .modal-close {
  position: absolute;
  top: var(--space-2);
  inset-inline-start: var(--space-2);
}

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

.export-format-list button {
  display: block;
  width: 100%;
  padding: 10px var(--space-2);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #2a2a30;
  border-radius: var(--radius-sm);
  color: var(--color-paper);
  text-align: right;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.export-format-list button:hover {
  background: #2a2a30;
  border-color: rgba(242, 147, 47, 0.35);
  color: var(--color-soft-orange);
}

#import-preview.import-preview {
  font-size: 13px;
  line-height: 1.45;
  max-height: 200px;
  overflow: auto;
  padding: var(--space-2);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #2a2a30;
  border-radius: var(--radius-sm);
}

.file-preview-dialog {
  margin: auto;
  padding: 0;
  border: 1px solid rgba(242, 147, 47, 0.18);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, #232328 0%, var(--color-graphite) 55%);
  color: var(--color-paper);
  max-width: min(96vw, 960px);
  width: 100%;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
.file-preview-dialog::backdrop {
  background: rgba(11, 11, 12, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.file-preview-panel {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 820px);
}
.file-preview-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.file-preview-heading h3 {
  margin: 0;
  font-size: 18px;
  word-break: break-word;
}
.file-preview-meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: #999;
}
.file-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  flex-shrink: 0;
}
.file-preview-body {
  flex: 1;
  min-height: 120px;
  overflow: auto;
  padding: var(--space-3) var(--space-4) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-preview-loading,
.file-preview-unsupported,
.file-preview-error,
.file-preview-truncated {
  margin: 0;
  text-align: center;
  color: #999;
  line-height: 1.6;
}
.file-preview-error { color: #e74c3c; }
.file-preview-img {
  max-width: 100%;
  max-height: min(70vh, 640px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
}
.file-preview-frame {
  width: 100%;
  min-height: min(70vh, 640px);
  height: min(70vh, 640px);
  border: none;
  border-radius: var(--radius-md);
  background: #1a1a1e;
}
.file-preview-media {
  width: 100%;
  max-width: 100%;
}
.file-preview-text {
  width: 100%;
  max-height: min(70vh, 640px);
  overflow: auto;
  margin: 0;
  padding: var(--space-3);
  background: #1a1a1e;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: start;
  direction: ltr;
  unicode-bidi: plaintext;
}

.progress-bar {
  height: 8px;
  background: #2a2a30;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  transition: width 0.3s;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.filters .select, .filters .input { width: auto; min-width: 140px; }

.page-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 50;
  overflow: visible;
  animation: fadeInRight 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.page-header-lead {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  align-self: flex-start;
  max-width: 100%;
  order: 0;
}
.page-header .header-actions,
.page-header .page-actions {
  width: auto;
  max-width: 100%;
  flex: 0 0 auto;
  order: 1;
  justify-content: flex-start;
  align-self: flex-start;
}
.page-header > .btn,
.page-header > a.btn {
  width: auto;
  max-width: 100%;
  flex: 0 0 auto;
  order: 1;
  align-self: flex-start;
}
@media screen and (min-width: 767px) {
  .page-header {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  .page-header h1 {
    flex: 1 1 auto;
    min-width: 0;
  }
  .page-header .header-actions,
  .page-header .page-actions,
  .page-header > .btn,
  .page-header > a.btn {
    align-self: center;
  }
}
.page-header h1 {
  font-weight: 700;
  font-size: var(--page-title-size);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.page-header .page-title-text { font-weight: 700; }
.header-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
  position: relative;
  z-index: 2;
}
.page-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
  position: relative;
  z-index: 2;
}
.invoice-view-actions {
  position: relative;
  z-index: 2;
}
.project-number-badge {
  font-size: 14px;
  color: var(--color-muted, #888);
  font-weight: 500;
}
.entity-history { margin-top: var(--space-4); }
.entity-history-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.entity-history-head h3 { font-size: 18px; margin: 0; }
.entity-history-hint {
  font-size: 13px;
  color: var(--color-muted, #888);
  margin: 0 0 var(--space-2);
}
.entity-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.entity-history-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 12px;
  border: 1px solid #2a2a30;
  border-radius: var(--radius-sm);
}
.entity-history-meta { display: flex; flex-direction: column; gap: 2px; }
.entity-history-meta span { font-size: 13px; color: var(--color-muted, #888); }
.entity-history-empty {
  padding: 12px;
  color: var(--color-muted, #888);
  font-size: 14px;
}
.modal .entity-history { margin-top: var(--space-3); border: none; box-shadow: none; }

.tabs { display: flex; gap: var(--space-1); margin-bottom: var(--space-3); flex-wrap: wrap; }
.tab-btn {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid #2a2a30;
  border-radius: var(--radius-sm);
  color: var(--color-paper);
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
}
.tab-btn.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.toast {
  position: fixed;
  top: var(--space-3);
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  background: var(--color-graphite);
  border: 1px solid #2a2a30;
  padding: 16px 22px 16px 18px;
  border-radius: var(--radius-md);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
  max-width: min(92vw, 520px);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-paper);
  text-align: right;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.toast-text {
  flex: 1;
  min-width: 0;
}
.toast-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.toast-success {
  border-color: rgba(46, 204, 113, 0.45);
}
.toast-success .toast-icon {
  color: #2ecc71;
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.45);
}
.toast-success .toast-icon::before {
  content: '\2713';
}
.toast-error {
  border-color: rgba(231, 76, 60, 0.45);
}
.toast-error .toast-icon {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.45);
}
.toast-error .toast-icon::before {
  content: '\2715';
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(-12px);
}

.export-dropdown {
  position: relative;
  display: inline-block;
  z-index: 1;
}
.export-dropdown.open {
  z-index: 1000;
}
.export-menu {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-end: 0;
  inset-inline-start: auto;
  left: auto;
  right: auto;
  background: var(--color-graphite);
  border: 1px solid #2a2a30;
  border-radius: var(--radius-sm);
  min-width: 10rem;
  max-width: min(12rem, calc(100vw - 1.5rem));
  display: none;
  z-index: 1001;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.page-header .export-menu,
.invoice-view-actions .export-menu,
[style*="flex"] .export-dropdown .export-menu {
  inset-inline-end: 0;
  inset-inline-start: auto;
  left: auto;
  right: auto;
}
@media screen and (max-width: 766px) {
  .export-menu,
  .page-header .export-menu,
  .invoice-view-actions .export-menu,
  [style*="flex"] .export-dropdown .export-menu {
    inset-inline-start: 0;
    inset-inline-end: auto;
  }
}
.export-dropdown.open .export-menu {
  display: block;
}

/* المحتوى تحت الرأس يبقى طبقة أدنى حتى لا يغطي القوائم المنسدلة */
.main-content > .kpi-grid,
.main-content > .charts-grid,
.main-content > .dashboard-tables,
.main-content > .filters-bar,
.main-content > section:not(.page-header) {
  position: relative;
  z-index: 1;
}
.export-menu button {
  display: block;
  width: 100%;
  padding: 10px var(--space-2);
  background: none;
  border: none;
  color: var(--color-paper);
  text-align: right;
  cursor: pointer;
}
.export-menu button {
  transition: color 0.28s ease 0.06s, background 0.28s ease 0.06s;
}
.export-menu button:hover {
  background: #2a2a30;
  color: var(--color-soft-orange);
  transition: color 0.22s ease 0s, background 0.22s ease 0s;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  background: var(--color-graphite);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}
.autocomplete-list.show { display: block; }
.autocomplete-item {
  padding: 10px var(--space-2);
  cursor: pointer;
}
.autocomplete-item:hover { background: #2a2a30; }

.step-progress {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.step-item {
  flex: 1;
  text-align: center;
  padding: var(--space-2);
  border: 1px solid #2a2a30;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}
.step-item.active { border-color: var(--color-primary); color: var(--color-primary); }
.step-item.done { border-color: #27ae60; color: #27ae60; }
.step-optional {
  font-size: 12px;
  font-weight: 500;
  color: rgba(244, 241, 236, 0.45);
}
.step-optional-hint {
  margin: 0 0 var(--space-3);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(244, 241, 236, 0.75);
  background: rgba(242, 147, 47, 0.08);
  border: 1px solid rgba(242, 147, 47, 0.2);
  border-radius: var(--radius-sm);
}
.step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
  align-items: center;
}
.step-panel { display: none; }
.step-panel.active { display: block; }

.view-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  align-items: center;
}
.view-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  min-height: 0;
  flex: 0 0 auto;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  background: var(--color-black);
  border: 1px solid #2a2a30;
  color: var(--color-paper);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition:
    color 0.28s ease 0.06s,
    border-color 0.28s ease 0.06s,
    background 0.28s ease 0.06s;
}
.view-toggle button:hover {
  color: var(--color-soft-orange);
  border-color: rgba(242, 147, 47, 0.45);
  transition:
    color 0.22s ease 0s,
    border-color 0.22s ease 0s,
    background 0.22s ease 0s;
}
.view-toggle button.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

