/* === CHART EMPTY STATE === */
.chart-empty { text-align:center; padding: 2.5rem 1rem; color: #94a3b8; font-size: .875rem; }

/* === DASHBOARD === */
.dashboard-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.dashboard-full { margin-bottom: 1.25rem; }

.bar-chart-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  padding: 0.375rem 0;
}

.bar-label  { width: 130px; color: var(--text-2); text-align: right; flex-shrink: 0; }
.bar-track  { flex: 1; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.bar-fill   { height: 100%; border-radius: 99px; transition: width 0.6s ease; }
.bar-count  { width: 2.25rem; text-align: left; color: var(--text-2); flex-shrink: 0; font-weight: 600; }

.recent-table td:first-child { font-weight: 600; }

/* === DASHBOARD HERO === */
.dash-hero {
  background: linear-gradient(135deg, #061530 0%, #0c2254 45%, #071a3e 100%);
  border-radius: var(--radius-lg);
  padding: 1.625rem 2rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  animation: cardIn 0.5s var(--ease) both;
}

.dash-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}

.dash-hero-glow {
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96,165,250,0.22) 0%, transparent 70%);
  top: -120px;
  right: -80px;
  pointer-events: none;
}

.dash-hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dash-hero-greeting {
  font-size: 1.375rem;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.dash-hero-sub {
  font-size: 0.8125rem;
  color: #7aa8cc;
  margin-top: 0.375rem;
  font-weight: 400;
}

.dash-hero-date-block {
  text-align: left;
  flex-shrink: 0;
}

.dash-hero-date {
  font-size: 0.9rem;
  font-weight: 700;
  color: #93c5fd;
  direction: ltr;
  white-space: nowrap;
}

.dash-hero-weekday {
  font-size: 0.72rem;
  color: #4e82a8;
  margin-top: 0.2rem;
  text-align: left;
}

/* === STAT CARD TRENDS === */
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.69rem;
  font-weight: 600;
  margin-top: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
}

.stat-trend-up   { background: #d1fae5; color: #065f46; }
.stat-trend-neutral { background: #f1f5f9; color: #475569; }

.stat-trend svg { width: 11px; height: 11px; flex-shrink: 0; }

/* === QUICK ACTIONS === */
.quick-actions {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  animation: slideUp 0.4s var(--ease) 0.1s both;
}

.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s, transform 0.18s, box-shadow 0.18s;
  text-decoration: none !important;
}

.quick-action-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.quick-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.18);
}

/* === RING STATUS CHART === */
.status-rings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.status-ring-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s;
  animation: slideUp 0.38s var(--ease) both;
}

.status-ring-item:hover {
  border-color: var(--ring-color, var(--border));
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ring-wrap {
  width: 42px;
  height: 42px;
  position: relative;
  flex-shrink: 0;
}

.ring-svg {
  width: 42px;
  height: 42px;
  display: block;
}

.ring-arc {
  transform-origin: 21px 21px;
}

.ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text);
}

/* === EXIT BUTTON (header) === */
.btn-exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  padding: 0;
  margin-right: 2px;
}
.btn-exit:hover {
  background: rgba(239,68,68,0.12);
  color: #ef4444;
}
.btn-exit svg { width: 14px; height: 14px; }

/* === SETTINGS PAGE === */
.settings-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 860px) {
  .settings-sections { grid-template-columns: 1fr; }
}
.settings-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.settings-card-icon svg { width: 18px; height: 18px; }

.ring-info { flex: 1; min-width: 0; }
.ring-lbl  { font-size: 0.79rem; font-weight: 500; color: var(--text-2); }
.ring-pct  { font-size: 0.69rem; font-weight: 600; margin-top: 0.1rem; }

/* === ACTIVITY FEED === */
.activity-feed { padding: 0.25rem 0; }

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1.125rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
  animation: slideUp 0.3s var(--ease) both;
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: #f0f7ff; }

.activity-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.activity-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: 0;
  animation: actPulse 2.5s ease infinite;
}

@keyframes actPulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  100% { transform: scale(2.4); opacity: 0; }
}

.activity-body { flex: 1; min-width: 0; }
.activity-name { font-size: 0.8125rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-meta { font-size: 0.7rem; color: var(--text-3); margin-top: 0.1rem; }
.activity-price { font-size: 0.8rem; font-weight: 700; color: var(--text-2); white-space: nowrap; }

/* === INFO GRID (used in detail pages) === */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem 1.25rem;
}

.info-item { display: flex; flex-direction: column; gap: 0.2rem; }

.info-label {
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-value {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

/* === PERSON DETAIL === */
.person-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.person-avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.4rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid rgba(59,130,246,0.28);
}

.person-header-info h2 { font-size: 1.2rem; margin-bottom: 0.3rem; }

/* === OWNERSHIP DETAIL === */
.ownership-price-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--primary-bg), var(--primary-100));
  border-radius: var(--radius-sm);
  border: 1px solid rgba(37,99,235,0.2);
  margin-top: 0.5rem;
}

.ownership-price-label { font-size: 0.875rem; color: var(--primary); font-weight: 500; }
.ownership-price-value { font-size: 1.2rem; font-weight: 800; color: var(--primary); }

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-2);
}
.price-row:last-child { border-bottom: none; }
.price-total {
  padding-top: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* === MACHINE STATUS INDICATORS === */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 0.375rem;
  flex-shrink: 0;
}

.dot-available   { background: var(--success); }
.dot-owned       { background: var(--primary); }
.dot-maintenance { background: var(--warning); }
.dot-retired     { background: var(--text-3); }

/* === BREADCRUMB === */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  color: var(--text-3);
  margin-bottom: 1rem;
}

.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span    { color: var(--text-2); font-weight: 500; }

/* === BACK LINK === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: 1rem;
  transition: color 0.15s;
}
.back-link:hover { color: var(--primary); }
.back-link svg   { width: 16px; height: 16px; }

/* === DETAIL SECTION LABEL === */
.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.875rem;
}

/* === FORMULA EDITOR — CARD UI === */
.fml-section { margin-bottom: 1.75rem; }

.fml-section-hdr {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  margin-bottom: 0.875rem;
  background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.fml-section-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fml-icon-k { background: #fef3c7; color: #b45309; }
.fml-icon-s { background: #fef3c7; color: #b45309; }

.fml-section-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.fml-section-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}

.fml-section-hint {
  font-size: 0.75rem;
  color: var(--text-3);
}

/* Grids */
.fml-grid { display: grid; gap: 0.625rem; }
.fml-grid-3 { grid-template-columns: repeat(3, 1fr); }
.fml-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Cards */
.fml-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.fml-card:hover {
  border-color: #c8d4e3;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.fml-card.fml-filled {
  border-right: 3px solid var(--primary);
  border-color: rgba(180,83,9,0.3);
  box-shadow: 0 2px 10px rgba(245,158,11,0.1);
}

.fml-card.fml-filled.fml-syrup {
  border-right-color: #f59e0b;
  border-color: rgba(245,158,11,0.3);
  box-shadow: 0 2px 10px rgba(245,158,11,0.1);
}

/* Card top bar */
.fml-card-top {
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, #f8fafc, #fff);
  border-bottom: 1px solid #f1f5f9;
}

.fml-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  background: #fef3c7;
  color: #92400e;
  user-select: none;
}

.fml-badge-s {
  background: #fef3c7;
  color: #92400e;
}

.fml-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e2e8f0;
  transition: background 0.25s, box-shadow 0.25s;
  flex-shrink: 0;
}

.fml-card.fml-filled .fml-dot:not(.fml-dot-s) {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.18);
}

.fml-card.fml-filled .fml-dot-s {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.2);
}

/* Card body */
.fml-card-body { padding: 0.7rem 0.75rem 0.65rem; }

.fml-name-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  outline: none;
  padding: 0;
  font-family: inherit;
  direction: rtl;
  display: block;
}

.fml-name-input::placeholder {
  color: #c5cdd8;
  font-weight: 400;
  font-size: 0.8rem;
}

.fml-time-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid #f1f5f9;
}

.fml-clock { color: #94a3b8; flex-shrink: 0; }

.fml-time-input {
  width: 52px;
  border: 1.5px solid #e8edf4;
  border-radius: 7px;
  padding: 0.22rem 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  background: #f8fafc;
  outline: none;
  font-family: monospace;
  transition: border-color 0.15s, background 0.15s;
  -moz-appearance: textfield;
}

.fml-time-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(245,158,11,0.15);
}

.fml-time-input::-webkit-inner-spin-button,
.fml-time-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.fml-sec {
  font-size: 0.7rem;
  color: #94a3b8;
  flex-shrink: 0;
}

/* formula select mode */
.fml-select {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  outline: none;
  cursor: pointer;
  font-family: inherit;
  direction: rtl;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0 center;
  padding-left: 1.1rem;
}

.fml-select option { font-weight: 400; }

.fml-mat-info {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.fml-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  white-space: nowrap;
}

.fml-chip-time  { background: #fef3c7; color: #92400e; }
.fml-chip-grams { background: #f0fdf4; color: #15803d; }
.fml-chip svg   { width: 10px; height: 10px; flex-shrink: 0; }

/* === MATERIAL CATEGORY PICKER === */
.mat-cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.mat-cat-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.125rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  text-align: right;
  font-family: inherit;
  width: 100%;
}

.mat-cat-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(245,158,11,0.12);
  transform: translateY(-1px);
}

.mat-cat-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mat-cat-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.mat-cat-arrow {
  color: var(--text-3);
  flex-shrink: 0;
  transition: transform 0.15s, color 0.15s;
}

.mat-cat-card:hover .mat-cat-arrow {
  color: var(--primary);
  transform: translateX(-3px);
}

/* === CUPS SECTION === */
.cups-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.625rem;
}

.cup-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.875rem 0.5rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  position: relative;
  user-select: none;
}

.cup-card:hover {
  border-color: #c8d4e3;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.cup-card.cup-selected {
  border-color: var(--cup-accent, var(--primary));
  background: var(--cup-bg, var(--primary-bg));
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.cup-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-3);
}

.cup-card.cup-selected .cup-label {
  background: var(--cup-accent, var(--primary));
  color: #fff;
}

.cup-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
}

.cup-card.cup-selected .cup-name {
  color: var(--cup-accent, var(--primary));
}

.cup-check {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--cup-accent, var(--primary));
  opacity: 0;
  transition: opacity 0.15s;
}

.cup-card.cup-selected .cup-check { opacity: 1; }

/* === POSITIONS SECTION === */
.positions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.position-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
}

.pos-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  min-width: 2rem;
  text-align: center;
  flex-shrink: 0;
}

.pos-field {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
}

.pos-field label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-3);
  flex-shrink: 0;
}

.btn-icon-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1.5px solid #fca5a5;
  background: #fff;
  color: #ef4444;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.btn-icon-danger:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .dashboard-cols   { grid-template-columns: 1fr; }
  .info-grid        { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .form-row-2 { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .module-grid { grid-template-columns: 1fr; }
}

/* ===== مدارک مشتریان (customer documents) ===== */
.docs-detail { display:flex; flex-direction:column; gap:0; }
.docs-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:1rem; }
.kv { display:flex; justify-content:space-between; gap:1rem; padding:.4rem 0; border-bottom:1px solid var(--border); font-size:.85rem; }
.kv:last-child { border-bottom:none; }
.kv-k { color:var(--text-soft,#6b7280); white-space:nowrap; }
.kv-v { font-weight:600; text-align:left; }
.doc-thumb { display:flex; flex-direction:column; align-items:center; gap:.4rem; width:200px; padding:.6rem; border:1px solid var(--border); border-radius:var(--radius); text-align:center; color:var(--primary); transition:box-shadow .15s; }
.doc-thumb:hover { box-shadow:0 2px 8px rgba(0,0,0,.08); }
.doc-thumb img { width:100%; height:140px; object-fit:cover; border-radius:var(--radius-xs); }
.doc-thumb.empty { color:var(--text-soft,#9ca3af); justify-content:center; height:160px; }
.filter-bar { display:flex; gap:.6rem; margin-bottom:1rem; flex-wrap:wrap; }
@media (max-width:760px){ .docs-grid{ grid-template-columns:1fr } }
