/* ================================================================
   ITUM ERP — COMPONENTS
   Ultra-premium enterprise UI component library
   ================================================================ */

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-family-primary);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  user-select: none;
}
.btn:focus-visible {
  outline: 2px solid var(--color-accent-400);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--gradient-accent);
  color: var(--color-white);
  box-shadow: 0 2px 12px rgba(99,102,241,0.35), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover {
  background: var(--gradient-accent-hover);
  box-shadow: 0 4px 20px rgba(99,102,241,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 6px rgba(99,102,241,0.3);
}

.btn-secondary {
  background: var(--surface-overlay);
  color: var(--text-primary);
  border-color: var(--border-secondary);
}
.btn-secondary:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-strong);
  color: var(--color-accent-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: rgba(99,102,241,0.08);
  color: var(--text-primary);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: var(--color-white);
  box-shadow: 0 2px 12px rgba(239,68,68,0.3);
}
.btn-danger:hover {
  box-shadow: 0 4px 20px rgba(239,68,68,0.45);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: var(--color-white);
}
.btn-success:hover {
  box-shadow: 0 4px 16px rgba(16,185,129,0.35);
}

.btn-outline {
  background: transparent;
  color: var(--color-accent-light);
  border-color: var(--border-accent);
}
.btn-outline:hover {
  background: rgba(99,102,241,0.1);
  border-color: var(--color-accent);
  color: var(--color-accent-300);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
  gap: var(--space-1-5);
}
.btn-lg {
  padding: 0.75rem 1.75rem;
  font-size: var(--text-md);
  border-radius: var(--radius-xl);
}
.btn-icon {
  padding: 0.5rem;
  min-width: 36px;
  min-height: 36px;
}
.btn-icon.btn-sm {
  padding: 0.3rem;
  min-width: 28px;
  min-height: 28px;
}

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
  overflow: hidden;
}
.card:hover {
  border-color: var(--border-primary);
  box-shadow: var(--shadow-md);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-secondary);
}
.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
}
.card-body {
  padding: var(--space-5) var(--space-6);
}
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-secondary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ── STAT CARDS ──────────────────────────────────────────────── */
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: var(--transition-base);
  text-align: right;
  direction: rtl;
}
.stat-card--link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.stat-card--link:hover {
  border-color: var(--color-accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), 0 0 16px rgba(99,102,241,0.15);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-hero);
  pointer-events: none;
}
.stat-card:hover {
  border-color: var(--border-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.stat-card-icon {
  font-size: 1.75rem;
  margin-bottom: var(--space-3);
  opacity: 0.9;
  color: var(--color-accent-light);
  position: relative;
}
.stat-card-icon.teal   { color: var(--color-teal-light); }
.stat-card-icon.purple { color: var(--color-purple-light); }
.stat-card-icon.gold   { color: var(--color-gold-light); }
.stat-card-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  font-family: var(--font-family-en);
  direction: rtl;
  unicode-bidi: plaintext;
  color: var(--text-primary);
  position: relative;
  text-align: right;
}
.stat-card-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  font-weight: 500;
  position: relative;
  text-align: right;
}

/* ── COMPACT STAT CARDS (used in daily-board) ───────────────── */
.stat-card.stat-card--compact {
  padding: var(--space-3) var(--space-4);
}
.stat-card--compact .stat-card-icon {
  font-size: 1.125rem;
  margin-bottom: var(--space-1);
  opacity: 0.85;
}
.stat-card--compact .stat-card-value {
  font-size: var(--text-xl);
  line-height: 1.1;
}
.stat-card--compact .stat-card-label {
  font-size: 0.7rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.db-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.db-filter-bar .seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--surface-glass, rgba(255,255,255,0.03));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 3px;
}
.db-filter-bar .seg button {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
  font-family: inherit;
}
.db-filter-bar .seg button:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}
.db-filter-bar .seg button.is-active {
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
}
.db-filter-bar .custom-range {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  margin-inline-start: auto;
}
.db-filter-bar .custom-range .form-input {
  padding: 6px 10px;
  font-size: var(--text-xs);
  height: auto;
  width: 140px;
}
.db-filter-bar .range-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── TABLE ───────────────────────────────────────────────────── */
.table-wrapper {
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}
.table-container {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead {
  background: rgba(6,8,13,0.4);
}
th {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  text-align: right;
  border-bottom: 1px solid var(--border-secondary);
  white-space: nowrap;
}
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}
th.sortable:hover {
  color: var(--color-accent-light);
}
th.sorted {
  color: var(--color-accent-light);
}
td {
  padding: var(--space-3-5) var(--space-4);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-secondary);
  color: var(--text-secondary);
  vertical-align: middle;
}
tr {
  transition: var(--transition-fast);
}
tbody tr:hover {
  background: rgba(99,102,241,0.04);
}
tbody tr:last-child td {
  border-bottom: none;
}
.table-empty {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--text-muted);
}
.table-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  justify-content: flex-end;
}

/* Table Toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-secondary);
  gap: var(--space-4);
}
.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.table-toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Table Footer / Pagination */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-secondary);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-family-en);
}
.pagination-btn:hover:not(:disabled) {
  background: rgba(99,102,241,0.08);
  color: var(--text-primary);
}
.pagination-btn.active {
  background: var(--gradient-accent);
  color: var(--color-white);
  font-weight: 600;
  box-shadow: var(--shadow-glow-sm);
}
.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── FORMS ───────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1-5);
}
.form-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: var(--tracking-wide);
}
.form-label .required {
  color: var(--color-error);
  margin-right: var(--space-1);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--surface-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-lg);
  transition: var(--transition-base);
  outline: none;
}
.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-strong);
  background: var(--surface-input-focus);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-input-focus);
  background: var(--surface-input-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15), var(--shadow-glow-sm);
}
.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--border-error);
  box-shadow: 0 0 0 3px var(--color-error-muted);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-disabled);
}
input[type="date"].form-input {
  cursor: pointer;
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7fa3'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  padding-left: 2.25rem;
}
.form-textarea {
  resize: vertical;
  min-height: 80px;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}
.form-hint {
  font-size: var(--text-2xs);
  color: var(--text-muted);
}
.form-error {
  font-size: var(--text-2xs);
  color: var(--color-error-light);
}
.form-checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
}
.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

/* ── SEARCH INPUT ────────────────────────────────────────────── */
.search-input-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  right: 0.75rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
  pointer-events: none;
}
.search-input {
  padding-right: 2.25rem;
  width: 260px;
  max-width: 100%;
}

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: 0.25rem 0.625rem;
  font-size: var(--text-2xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: var(--tracking-wide);
  line-height: 1.4;
  white-space: nowrap;
}
.badge-dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-default  { background: rgba(148,163,195,0.12); color: var(--color-gray-200); }
.badge-success  { background: var(--color-success-muted); color: var(--color-success-light); }
.badge-error    { background: var(--color-error-muted); color: var(--color-error-light); }
.badge-warning  { background: var(--color-warning-muted); color: var(--color-warning-light); }
.badge-info     { background: var(--color-info-muted); color: var(--color-info-light); }
.badge-primary  { background: rgba(99,102,241,0.15); color: var(--color-accent-300); }
.badge-purple   { background: rgba(139,92,246,0.15); color: var(--color-purple-300); }
.badge-teal     { background: rgba(20,184,166,0.15); color: var(--color-teal-300); }
.badge-gold     { background: rgba(245,158,11,0.15); color: var(--color-gold-300); }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn var(--duration-base) var(--ease-out);
}
.modal {
  background: var(--surface-modal);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl), var(--shadow-glow);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  animation: modalSlideUp var(--duration-slow) var(--ease-out);
}
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1050px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-secondary);
}
.modal-title {
  font-size: var(--text-xl);
  font-weight: 700;
}
.modal-body {
  padding: var(--space-6);
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-secondary);
}

/* ── DRAWER ──────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn var(--duration-base) var(--ease-out);
}
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 480px;
  max-width: 90vw;
  background: var(--surface-overlay);
  border-right: 1px solid var(--border-primary);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-2xl);
  animation: drawerSlideIn var(--duration-slow) var(--ease-out);
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-secondary);
}
.drawer-body {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
}
.drawer-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-secondary);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ── TABS ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-secondary);
  margin-bottom: var(--space-6);
  padding: 0 var(--space-1);
}
.tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  bottom: -1px;
}
.tab:hover {
  color: var(--text-primary);
  background: rgba(99,102,241,0.04);
}
.tab.active {
  color: var(--color-accent-light);
  font-weight: 600;
  border-bottom-color: var(--color-accent);
}

/* ── TOAST ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  left: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 420px;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3-5) var(--space-5);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--surface-overlay);
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: toastIn var(--duration-slow) var(--ease-spring);
}
.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
}
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  font-size: var(--text-xs);
  margin-right: calc(-1 * var(--space-2));
}
.toast-close:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}
.toast-success .toast-icon { background: var(--color-success-muted); color: var(--color-success-light); }
.toast-error   .toast-icon { background: var(--color-error-muted);   color: var(--color-error-light); }
.toast-warning .toast-icon { background: var(--color-warning-muted); color: var(--color-warning-light); }
.toast-info    .toast-icon { background: var(--color-info-muted);    color: var(--color-info-light); }

/* ── BREADCRUMBS ─────────────────────────────────────────────── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}
.breadcrumbs a {
  color: var(--text-muted);
  transition: var(--transition-fast);
}
.breadcrumbs a:hover {
  color: var(--color-accent-light);
}
.breadcrumbs .separator {
  color: var(--color-gray-300);
  font-size: var(--text-2xs);
}
.breadcrumbs .current {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background: var(--gradient-accent-subtle);
  color: var(--color-accent-light);
  border-radius: var(--radius-2xl);
  margin-bottom: var(--space-5);
  border: 1px solid var(--border-accent);
}
.empty-state-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.empty-state-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-6);
  max-width: 360px;
}

/* ── SKELETON ────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-raised) 25%, var(--surface-overlay) 50%, var(--surface-raised) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
.skeleton-row {
  height: 48px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-md);
}
.skeleton-card {
  height: 140px;
  border-radius: var(--radius-xl);
}

/* ── CONFIRM DIALOG ──────────────────────────────────────────── */
.confirm-dialog {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-4) 0;
}
.confirm-dialog-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-5);
}
.confirm-dialog-icon.danger {
  background: var(--color-error-muted);
  color: var(--color-error-light);
}
.confirm-dialog-icon.warning {
  background: var(--color-warning-muted);
  color: var(--color-warning-light);
}
.confirm-dialog-title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.confirm-dialog-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-6);
}
.confirm-dialog-actions {
  display: flex;
  gap: var(--space-3);
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
}
.sidebar-brand-logo {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow-sm);
}
.sidebar-brand-icon {
  color: var(--color-white);
  font-size: 1.125rem;
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}
.sidebar-brand-name {
  font-size: var(--text-xl);
  font-weight: 800;
  font-family: var(--font-family-en);
  letter-spacing: var(--tracking-tight);
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-brand-tagline {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  letter-spacing: var(--tracking-wide);
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-2) 0;
}
.sidebar-section {
  margin-bottom: var(--space-2);
}
.sidebar-section-title {
  font-size: var(--text-2xs);
  font-weight: 700;
  color: var(--text-disabled);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  padding: var(--space-3) var(--space-5) var(--space-2);
}
.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.5rem var(--space-5);
  margin: 2px var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-lg);
  transition: var(--transition-fast);
  text-decoration: none;
  position: relative;
  cursor: pointer;
  user-select: none;
}
.sidebar-nav-link:hover {
  background: rgba(99,102,241,0.06);
  color: var(--text-primary);
}
.sidebar-nav-link.active {
  background: rgba(99,102,241,0.1);
  color: var(--color-accent-light);
  font-weight: 600;
}
.sidebar-nav-link.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--gradient-accent);
  border-radius: var(--radius-full);
}
.nav-icon {
  font-size: 1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-nav-link.active .nav-icon {
  opacity: 1;
}
.nav-active-dot {
  display: none;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-secondary);
}
.sidebar-footer-text {
  font-size: var(--text-2xs);
  color: var(--text-disabled);
  text-align: center;
}

/* ── HEADER ──────────────────────────────────────────────────── */
.header-menu-btn {
  display: none;
}
/* ── TENANT SWITCHER ─────────────────────────────────────────── */
.tenant-switcher {
  position: relative;
}
.tenant-switcher-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  cursor: default;
  transition: all 0.2s ease;
  color: inherit;
}
.tenant-switcher--multi .tenant-switcher-trigger {
  cursor: pointer;
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.15);
}
.tenant-switcher--multi .tenant-switcher-trigger:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}
.tenant-switcher-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-accent), #7c3aed);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
}
.tenant-switcher-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.tenant-switcher-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.tenant-switcher-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tenant-switcher-chevron {
  font-size: var(--text-lg);
  color: var(--text-muted);
  transition: transform 0.25s ease;
  margin-inline-start: var(--space-1);
}
.tenant-switcher-panel.open ~ .tenant-switcher-trigger .tenant-switcher-chevron,
.tenant-switcher .tenant-switcher-panel.open + .tenant-switcher-trigger .tenant-switcher-chevron {
  transform: rotate(-90deg);
}

/* ── Panel ── */
.tenant-switcher-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  max-width: 340px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: var(--space-2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.97);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: var(--z-dropdown, 900);
}
.tenant-switcher-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.tenant-switcher-panel-header {
  padding: var(--space-2) var(--space-3);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-secondary);
  margin-bottom: var(--space-1);
}
.tenant-switcher-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2-5) var(--space-3);
  border: none;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: right;
}
.tenant-switcher-item:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
}
.tenant-switcher-item--active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--text-primary);
}
.tenant-switcher-item--active:hover {
  background: rgba(99, 102, 241, 0.16);
}
.tenant-switcher-item-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  border: 1px solid var(--border-secondary);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.tenant-switcher-item--active .tenant-switcher-item-avatar {
  background: linear-gradient(135deg, var(--color-accent), #7c3aed);
  border-color: transparent;
  color: #fff;
}
.tenant-switcher-item-name {
  flex: 1;
  font-weight: 500;
}
.tenant-switcher-item--active .tenant-switcher-item-name {
  font-weight: 700;
}
.tenant-switcher-item-check {
  color: var(--color-accent-light);
  font-size: var(--text-sm);
  font-weight: 700;
}
.tenant-switcher-item--loading {
  opacity: 0.6;
  pointer-events: none;
}
.header-notif-wrapper {
  position: relative;
}
.header-notif-btn {
  position: relative;
}
.header-notif-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--color-error);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  border: 2px solid var(--surface-header);
  font-family: var(--font-en);
}
.header-notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 360px;
  max-height: 440px;
  background: rgb(19, 26, 46);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.header-notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-secondary);
  font-weight: 600;
  font-size: 0.9rem;
}
.header-notif-list {
  overflow-y: auto;
  max-height: 380px;
  flex: 1;
}
.header-notif-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.header-notif-item {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-secondary);
  cursor: pointer;
  transition: background 0.15s;
  background: transparent;
}
.header-notif-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.header-notif-item--unread {
  background: rgba(59, 130, 246, 0.12);
  border-right: 3px solid var(--color-accent);
}
.header-notif-item--unread .header-notif-title {
  color: var(--color-accent);
}
.header-notif-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.header-notif-content {
  flex: 1;
  min-width: 0;
}
.header-notif-title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}
.header-notif-msg {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: 2px;
}
.header-notif-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.header-user {
  position: relative;
}
.header-user-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2-5);
  padding: var(--space-1-5) var(--space-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: var(--transition-fast);
}
.header-user-btn:hover {
  background: rgba(99,102,241,0.06);
  border-color: var(--border-secondary);
}
.header-avatar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-accent);
  color: var(--color-white);
  font-weight: 700;
  font-size: var(--text-xs);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.header-avatar-lg {
  width: 40px;
  height: 40px;
  font-size: var(--text-sm);
}
.header-user-info {
  display: flex;
  flex-direction: column;
  text-align: right;
}
.header-user-name {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-primary);
}
.header-user-role {
  font-size: var(--text-2xs);
  color: var(--text-muted);
}
.header-chevron {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  transition: var(--transition-fast);
}

/* Header Dropdown */
.header-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  min-width: 240px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  overflow: hidden;
  animation: fadeIn var(--duration-fast) var(--ease-out);
}
.header-dropdown-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
}
.header-dropdown-name {
  font-weight: 600;
  font-size: var(--text-sm);
}
.header-dropdown-email {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  font-family: var(--font-family-en);
  direction: ltr;
  unicode-bidi: isolate;
}
.header-dropdown-divider {
  height: 1px;
  background: var(--border-secondary);
}
.header-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2-5) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  text-align: right;
  cursor: pointer;
  transition: var(--transition-fast);
}
.header-dropdown-item:hover {
  background: rgba(99,102,241,0.06);
  color: var(--text-primary);
}
.header-dropdown-danger {
  color: var(--color-error-light);
}
.header-dropdown-danger:hover {
  background: var(--color-error-muted);
}

/* ── DETAIL ROW ──────────────────────────────────────────────── */
.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-secondary);
}
.detail-row:last-child {
  border-bottom: none;
}
.detail-row-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.detail-row-value {
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-weight: 500;
  text-align: left;
}
.detail-row-value.mono {
  font-family: var(--font-family-en);
  direction: ltr;
  unicode-bidi: isolate;
}

/* ── SPINNER ─────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-secondary);
  border-top-color: var(--color-accent-light);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

/* ── ANIMATIONS ──────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes drawerSlideIn {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-24px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
.animate-spin  { animation: spin 1s linear infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* ── PROGRESS BAR ───────────────────────────────────────────── */
.progress-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.progress-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
}
.progress-bar-label {
  color: var(--text-secondary);
  font-weight: 500;
}
.progress-bar-value {
  font-family: var(--font-family-en);
  font-weight: 700;
  color: var(--text-primary);
}
.progress-bar {
  height: 8px;
  background: rgba(148,163,195,0.12);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-out);
  background: var(--gradient-accent);
}
.progress-bar-fill.success { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-bar-fill.warning { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress-bar-fill.error   { background: linear-gradient(90deg, #ef4444, #f87171); }
.progress-bar-fill.teal    { background: var(--gradient-teal); }
.progress-bar-fill.purple  { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

/* ── SECTION (for detail pages) ─────────────────────────────── */
.section-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(12px);
  overflow: hidden;
  margin-bottom: var(--space-6);
}
.section-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}
.section-panel-header:hover {
  background: rgba(99,102,241,0.04);
}
.section-panel-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-md);
  font-weight: 700;
}
.section-panel-title .section-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
}
.section-panel-title .section-icon.accent  { background: rgba(99,102,241,0.15); color: var(--color-accent-light); }
.section-panel-title .section-icon.teal    { background: rgba(20,184,166,0.15); color: var(--color-teal-light); }
.section-panel-title .section-icon.purple  { background: rgba(139,92,246,0.15); color: var(--color-purple-light); }
.section-panel-title .section-icon.gold    { background: rgba(245,158,11,0.15); color: var(--color-gold-light); }
.section-panel-title .section-icon.error   { background: var(--color-error-muted); color: var(--color-error-light); }
.section-panel-title .section-icon.success { background: var(--color-success-muted); color: var(--color-success-light); }
.section-panel-badge {
  font-size: var(--text-2xs);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(99,102,241,0.1);
  color: var(--color-accent-light);
  font-weight: 600;
}
.section-panel-body {
  padding: var(--space-5) var(--space-6);
}

/* ── WIZARD PROGRESS ───────────────────────────────────────── */
.wizard-progress {
  padding: var(--space-4) var(--space-6);
  background: var(--surface-raised);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
}
.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-width: 80px;
}
.wizard-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: var(--text-sm);
  font-weight: 700;
  background: rgba(148,163,195,0.10);
  color: var(--text-muted);
  border: 2px solid var(--border-subtle);
  transition: all 0.25s ease;
}
.wizard-step-label {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.wizard-step.active .wizard-step-num {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 0 12px rgba(99,102,241,0.4);
}
.wizard-step.active .wizard-step-label {
  color: var(--color-accent-light);
  font-weight: 600;
}
.wizard-step.completed .wizard-step-num {
  background: var(--color-success);
  color: #fff;
  border-color: var(--color-success);
}
.wizard-step.completed .wizard-step-label {
  color: var(--color-success-light);
}
.wizard-step-line {
  flex: 1;
  height: 2px;
  min-width: 30px;
  background: var(--border-subtle);
  border-radius: 1px;
  transition: background 0.25s ease;
  align-self: center;
  margin-bottom: 18px;
}
.wizard-step-line.completed {
  background: var(--color-success);
}

/* ── APPROVAL BAR (calc-detail) ──────────────────────────────── */
.approval-bar .approval-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-subtle);
  display: inline-block;
  margin-left: var(--space-1);
}
.approval-bar .approval-step.done .approval-dot {
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(34,197,94,0.4);
}
.approval-bar .approval-label {
  font-size: var(--text-2xs);
  font-weight: 500;
  color: var(--text-muted);
}
.approval-bar .approval-step.done .approval-label {
  color: var(--color-success-light);
}
.approval-bar .approval-line {
  flex: 1;
  height: 2px;
  min-width: 20px;
  background: var(--border-subtle);
  align-self: center;
}
.approval-bar .approval-line.done {
  background: var(--color-success);
}

/* ── APPROVAL BAR ───────────────────────────────────────────── */
.approval-bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--surface-raised);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-6);
}
.approval-bar .approval-steps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
}
.approval-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1-5) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-2xs);
  font-weight: 600;
  background: rgba(148,163,195,0.08);
  color: var(--text-muted);
}
.approval-step.active {
  background: rgba(99,102,241,0.15);
  color: var(--color-accent-light);
  box-shadow: 0 0 0 1px rgba(99,102,241,0.3);
}
.approval-step.done {
  background: var(--color-success-muted);
  color: var(--color-success-light);
}
.approval-step.rejected {
  background: var(--color-error-muted);
  color: var(--color-error-light);
}
.approval-arrow {
  color: var(--text-disabled);
  font-size: var(--text-2xs);
}

/* ── ALERT CARD ─────────────────────────────────────────────── */
.alert-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3-5) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
  border: 1px solid;
}
.alert-card.warning {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.2);
  color: var(--color-warning-light);
}
.alert-card.error {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.2);
  color: var(--color-error-light);
}
.alert-card.info {
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.2);
  color: var(--color-info-light);
}
.alert-card.success {
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.2);
  color: var(--color-success-light);
}
.alert-card-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
  line-height: 1;
}

/* ── INLINE EDITABLE ROWS ───────────────────────────────────── */
.inline-row {
  display: grid;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-secondary);
}
.inline-row:last-child { border-bottom: none; }
.inline-row .form-input,
.inline-row .form-select {
  padding: 0.375rem 0.625rem;
  font-size: var(--text-xs);
}

/* ── STAGE COLOR DOT ────────────────────────────────────────── */
.stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ── AI PANEL ──────────────────────────────────────────────── */
.ai-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: aiSpin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: var(--space-1);
}
@keyframes aiSpin { to { transform: rotate(360deg); } }

.ai-summary-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-raised);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
}
.ai-summary-total {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.ai-summary-chip {
  font-size: var(--text-2xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.ai-summary-chip.critical { background: rgba(239,68,68,0.15); color: var(--color-danger); }
.ai-summary-chip.warning  { background: rgba(245,158,11,0.15); color: var(--color-warning); }
.ai-summary-chip.info     { background: rgba(99,102,241,0.12); color: var(--color-accent-light); }
.ai-summary-chip.pending  { background: rgba(148,163,195,0.12); color: var(--text-muted); }
.ai-summary-chip.gpt      { background: rgba(16,163,127,0.15); color: #10a37f; }

.ai-rec-card {
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  transition: border-color 0.2s ease;
}
.ai-rec-card:hover { border-color: var(--border-accent); }
.ai-rec-gpt {
  background: linear-gradient(135deg, var(--surface-card) 0%, rgba(16,163,127,0.04) 100%);
}
.ai-badge-gpt {
  background: rgba(16,163,127,0.15);
  color: #10a37f;
  border: 1px solid rgba(16,163,127,0.3);
}

.ai-rec-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.ai-rec-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.ai-rec-icon { font-size: 1em; flex-shrink: 0; }
.ai-rec-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.ai-rec-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
  line-height: 1.5;
}

.ai-confidence-bar {
  width: 50px;
  height: 6px;
  background: rgba(148,163,195,0.15);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}
.ai-confidence-fill {
  display: block;
  height: 100%;
  background: var(--color-accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.ai-rec-values {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
}
.ai-value {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(148,163,195,0.08);
  color: var(--text-secondary);
}
.ai-value.suggested {
  background: rgba(99,102,241,0.12);
  color: var(--color-accent-light);
}

.ai-rec-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.ai-expert-response {
  margin-top: var(--space-2);
  padding: var(--space-2);
  background: rgba(34,197,94,0.06);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.ai-evidence {
  margin-top: var(--space-2);
}
.ai-evidence summary {
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--color-accent-light);
  font-weight: 500;
  user-select: none;
}
.ai-evidence summary:hover { text-decoration: underline; }
.ai-evidence-body {
  margin-top: var(--space-2);
  padding: var(--space-2);
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}
.ai-evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-2);
}
.ai-evidence-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ai-evidence-item.full { grid-column: 1 / -1; }
.ai-ev-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--text-2xs);
  text-transform: uppercase;
}
.ai-ev-value {
  color: var(--text-primary);
}
.ai-ev-json {
  background: var(--surface-card);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: var(--text-2xs);
  max-height: 200px;
  overflow-y: auto;
}
.ai-applied-badge {
  margin-top: var(--space-2);
}
.ai-applied-badge .badge {
  gap: var(--space-1);
}
/* ── Tooltip (?) ───────────────────────────────────── */
.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 1px solid var(--border-secondary);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  margin-inline-start: 4px;
  vertical-align: middle;
  flex-shrink: 0;
  transition: all 0.2s;
  font-family: system-ui, sans-serif;
  line-height: 1;
}
.tip:hover {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
/* Global floating tooltip (appended to body via JS) */
#global-tip {
  position: fixed;
  display: none;
  background: var(--surface-overlay, #1e2130);
  color: var(--text-primary, #e2e8f0);
  border: 1px solid var(--border-secondary, #2d3348);
  border-radius: var(--radius-md, 8px);
  padding: 10px 14px;
  font-size: var(--text-xs, 0.75rem);
  font-weight: 400;
  line-height: 1.6;
  min-width: 220px;
  max-width: 320px;
  white-space: normal;
  word-wrap: break-word;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
  direction: rtl;
  text-align: right;
}
#global-tip.visible {
  opacity: 1;
}
/* Tooltip label — next to form labels */
.form-label .tip {
  margin-inline-start: 6px;
}
/* Section tooltip — next to h3/h4 headers */
h3 .tip, h4 .tip {
  font-size: 11px;
  width: 18px;
  height: 18px;
}

/* ── AI Quantity Comparison ─────────────────────────── */
.ai-qty-compare {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-2) 0;
  padding: var(--space-3);
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
}
.ai-qty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  min-width: 100px;
}
.ai-qty-box.current {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-secondary);
}
.ai-qty-box.suggested {
  background: rgba(16,163,127,0.08);
  border: 1px solid rgba(16,163,127,0.3);
}
.ai-qty-label {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  text-transform: uppercase;
}
.ai-qty-num {
  font-size: 1.4em;
  font-weight: 700;
}
.ai-qty-box.suggested .ai-qty-num {
  color: #10a37f;
}
.ai-qty-arrow {
  font-size: 1.1em;
  font-weight: 700;
  white-space: nowrap;
}

/* ── PO from Calc preview ──────────────────────────── */
.po-no-supplier {
  opacity: 0.5;
}
.po-no-supplier td {
  text-decoration: line-through;
}
.form-input-sm {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
}
.form-select-sm {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
}

/* ── RESPONSIVE: Mobile header menu ──────────────────────────── */
@media (max-width: 768px) {
  .header-menu-btn { display: flex; }
  .header-user-info { display: none; }
  .header-chevron { display: none; }
  .tenant-switcher-sub { display: none; }
  .tenant-switcher-name { font-size: var(--text-xs); }
  .tenant-switcher-panel { right: auto; left: 0; }
}
