:root{
    --bg: #0b1220;
    --panel: rgba(255,255,255,.06);
    --card: rgba(255,255,255,.08);
    --border: rgba(255,255,255,.10);
    --text: rgba(255,255,255,.92);
    --muted: rgba(255,255,255,.60);
    --accent: #4f8cff;
    --accent2: #2dd4bf;
    --danger: #ff5a7a;
    --warn: #fbbf24;
    --success: #22c55e;
  }
  
  *{ font-family: "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial; }
  
  .app-bg{
    background:
      radial-gradient(1000px 600px at 90% -10%, rgba(79,140,255,.35), transparent 60%),
      radial-gradient(800px 500px at 10% 0%, rgba(45,212,191,.20), transparent 55%),
      linear-gradient(180deg, #070b14, #0b1220 55%, #0b1220);
    color: var(--text);
    min-height: 100vh;
  }
  
  .app-nav{
    background: rgba(15, 23, 42, .70);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  
  .brand-dot{
    display:inline-block;
    width:10px;height:10px;border-radius:999px;
    margin-left:8px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    box-shadow: 0 0 0 4px rgba(79,140,255,.12);
    vertical-align: middle;
  }
  
  .navbar .nav-link{
    border-radius: 12px;
    padding: .45rem .75rem;
    color: rgba(255,255,255,.78);
  }
  .navbar .nav-link:hover{ background: rgba(255,255,255,.06); color: #fff; }
  .navbar .nav-link.active{ background: rgba(79,140,255,.18); color: #fff; }
  
  .app-alert{
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.10);
    color: var(--text);
    border-radius: 16px;
  }
  .alert-icon{
    width:10px;height:10px;border-radius:999px;
    background: var(--accent2);
    margin-top: .45rem;
    box-shadow: 0 0 0 4px rgba(45,212,191,.12);
  }
  
  /* Cards */
  .card{
    background: rgba(255,255,255,.06) !important;
    border: 1px solid rgba(255,255,255,.10) !important;
    border-radius: 18px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,.22);
  }
  .card .card-title{ color: #fff; }
  .text-secondary, .text-muted{ color: var(--muted) !important; }
  
  /* Inputs */
  .form-control, .form-select{
    background: rgba(255,255,255,.06) !important;
    border: 1px #19202D !important;
    color: var(--text) !important;
    border-radius: 14px !important;
  }
  .form-control::placeholder{ color: rgba(255,255,255,.45); }
  .form-control:focus, .form-select:focus{
    border-color: rgba(79,140,255,.55) !important;
    box-shadow: 0 0 0 .20rem rgba(79,140,255,.18) !important;
  }
  
  /* Buttons */
  .btn{
    border-radius: 14px !important;
    font-weight: 600;
  }
  .btn-primary{
    background: linear-gradient(135deg, #4f8cff, #3b82f6) !important;
    border: none !important;
  }
  .btn-success{
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    border: none !important;
  }
  .btn-outline-dark, .btn-outline-secondary, .btn-outline-primary{
    border-color: rgba(255,255,255,.18) !important;
    color: var(--text) !important;
  }
  .btn-outline-dark:hover, .btn-outline-secondary:hover, .btn-outline-primary:hover{
    background: rgba(255,255,255,.08) !important;
  }
  
  /* Table */
  .table{
    color: var(--text);
    border-color: rgba(255,255,255,.10) !important;
  }
  .table thead th{
    color: rgba(255,255,255,.75);
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,.12) !important;
  }
  .table tbody tr{
    transition: transform .08s ease, background .12s ease;
  }
  .table tbody tr:hover{
    background: rgba(255,255,255,.05);
  }
  .table-warning{
    background: rgba(251,191,36,.12) !important;
  }
  .table-success{
    background: rgba(34,197,94,.12) !important;
  }
  
  /* Helpers */
  .mono{
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
    letter-spacing: .2px;
  }
  
  .thumb{
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.05);
  }
  
  .pre-wrap{
    white-space: pre-wrap;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.10);
    padding: 12px;
    border-radius: 16px;
  }
  
  /* Packing scan emphasis */
  .scan-box{
    background: linear-gradient(180deg, rgba(79,140,255,.12), rgba(255,255,255,.04));
    border: 1px solid rgba(79,140,255,.20);
    border-radius: 18px;
    padding: 14px;
  }
/* Allow text selection everywhere */
html, body, .card, .card-body, .table, .table * , .panel, .panel * {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    user-select: text !important;
    direction: ltr;
  }
  
  /* But keep buttons etc normal (optional) */
  button, .btn, input, textarea, select {
    -webkit-user-select: auto !important;
    user-select: auto !important;
  }
/* Force readable colors on dark panels */
h1,h2,h3,h4,h5,h6,
.card-title,
.form-label,
.table thead th,
.navbar, .navbar * {
  color: rgba(235, 245, 255, 0.95) !important;
}

.text-secondary {
  color: rgba(226,232,240,.70) !important;
}
/* ========= Fix: text on light surfaces must be dark ========= */

/* جدول و محتواهای روشن */
.table,
.table * {
  color: #0f172a !important;   /* slate-900 */
}

/* هدر جدول اگر بکگراندش روشن/سفید میشه */
.table thead th {
  color: #0b1220 !important;
}

/* ردیف‌های رنگی bootstrap هم متنش تیره بماند */
.table-warning,
.table-warning * ,
.table-success,
.table-success * ,
.table-light,
.table-light * {
  color: #0f172a !important;
}

/* باکس‌های سفید سمت راست (manual/webcam/...) */
.bg-light,
.bg-light *,
.card.bg-light,
.card.bg-light * {
  color: #0f172a !important;
}

/* فرم‌ها: input/select/option/label داخل کارت‌ها */
input, select, textarea, option, label {
  color: #0f172a !important;
}

/* placeholder ها خاکستری تیره */
::placeholder {
  color: #64748b !important;  /* slate-500 */
  opacity: 1;
}

/* برای اطمینان: متن‌های muted هم خوانا */
.text-secondary {
  color: #64748b !important;
}

/* جلوگیری از سفید شدن لینک‌ها داخل table */
.table a {
  color: #0b4dd8 !important;
}
/* هرجا surface-light زدیم => متن تیره و خوانا */
.surface-light,
.surface-light * {
  color: #0f172a !important;
}

.surface-light .text-secondary {
  color: #64748b !important;
}

.surface-light input,
.surface-light select,
.surface-light textarea,
.surface-light option {
  color: #0f172a !important;
}

.surface-light ::placeholder {
  color: #64748b !important;
  opacity: 1;
}
/* دکمه اصلی */
.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: none;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(37,99,235,.35);
  }
  .btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
  }
  
  /* دکمه موفق */
  .btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(34,197,94,.35);
  }
  .btn-success:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
  }
  
  /* دکمه outline */
  .btn-outline-dark,
  .btn-outline-secondary {
    color: #0f172a !important;
    border: 1px solid #cbd5e1;
    background: #2fa287;
  }
  .btn-outline-dark:hover,
  .btn-outline-secondary:hover {
    background: #e2e8f0;
  }
  select.form-select {
    background-color: #fff !important;
    color: #0f172a !important;
    border: 2px solid #2563eb !important;
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 0 0 transparent;
  }
  
  /* وقتی فوکوس می‌گیره */
  select.form-select:focus {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34,197,94,.25);
    outline: none;
  }
  select.form-select option {
    white-space: normal;
    color: #0f172a;
  }
  
  /* خود سلکتور */
  select.form-select {
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .form-select {
    min-width: 100%;
  }
  .surface-light,
.surface-light * {
  color: #0f172a !important;
}
input.form-control {
    background: #0b1220;
    border: 2px solid #334155;
    color: #e5e7eb;
    border-radius: 10px;
  }
  input.form-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.25);
  }
  body {
    direction: rtl;
    text-align: right;
  }
  .card,
  .card-body,
  .table,
  .modal-content,
  .modal-header,
  .modal-body,
  .modal-footer,
  .form-control,
  .form-select {
    direction: rtl !important;
    text-align: right !important;
  }
  .modal-header .btn-close {
    margin-left: 0 !important;
    margin-right: auto !important;
  }
  .table th,
  .table td {
    text-align: right;
    direction: rtl;
  }
  
  .table th.text-center,
  .table td.text-center {
    text-align: center !important;
  }
  .form-select {
    direction: rtl;
    text-align: right;
    padding-right: 12px;
    padding-left: 40px; /* جا برای آیکن */
  }
  
  .form-select option {
    direction: rtl;
    text-align: right;
  }
  