/* =========================================================
   ADMIN
========================================================= */

.meta{
  color: var(--muted);
  font-size: 13px;
}

/* =========================================================
   KPI / STATS
========================================================= */

.stats-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:12px;
  margin: 14px 0 10px;
}

@media (max-width: 900px){
  .stats-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px){
  .stats-grid{ grid-template-columns: 1fr; }
}

.stat-card{
  background: var(--card);
  border: 0 !important;
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(0,0,0,.08);
}

body.dark .stat-card{
  box-shadow: 0 22px 52px rgba(0,0,0,.50);
}

.stat-card::before{
  content:"";
  position:absolute;
  inset:0;
  background: radial-gradient(650px 200px at 20% 0%, rgba(99,102,241,.14), transparent 60%);
  pointer-events:none;
}

body.dark .stat-card::before{
  background: radial-gradient(650px 200px at 20% 0%, rgba(56,189,248,.12), transparent 60%);
}

.stat-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  position:relative;
  z-index:1;
}

.stat-title{
  margin:0;
  font-size:13px;
  color: var(--muted);
}

.stat-value{
  margin: 6px 0 2px;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.stat-sub{
  color: var(--muted);
  font-size: 12px;
}

.badge-warn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, .12);
  border: 1px solid rgba(245, 158, 11, .25);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

/* =========================================================
   ADMIN TOOLBAR
========================================================= */

.admin-toolbar{
  border-radius: 20px;
  overflow: hidden;
}

.admin-toolbar.card{
  box-shadow: 0 14px 34px rgba(0,0,0,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.94));
}

body.dark .admin-toolbar.card{
  box-shadow: 0 22px 52px rgba(0,0,0,.50);
  background: linear-gradient(180deg, rgba(15,23,42,.98), rgba(15,23,42,.94));
}

.admin-toolbar .card-body{
  padding: 14px 16px;
}

.admin-toolbar .h3{
  font-weight: 900;
  letter-spacing: -0.02em;
}

.admin-search{
  flex: 1 1 520px;
  max-width: 720px;
}

.admin-search .form-control,
.admin-search .btn{
  height: 44px;
  border-radius: 12px;
}

.admin-pagehint{
  white-space: nowrap;
}

html[dir="rtl"] .admin-pagehint{
  margin-left: 0 !important;
  margin-right: auto !important;
}

/* =========================================================
   DASHBOARD / ADMIN TABS
========================================================= */

.admin-tabs{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items:center;
  justify-content: flex-end;
}

.admin-tabs .btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px !important;
  padding: .58rem .98rem;
  border: 1px solid rgba(0,0,0,.08) !important;
  background: rgba(255,255,255,.84);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(0,0,0,.05);
  transition:
    transform .14s ease,
    background .14s ease,
    border-color .14s ease,
    box-shadow .14s ease,
    color .14s ease;
}

.admin-tabs .btn:hover{
  background: rgba(255,255,255,.98);
  border-color: rgba(0,0,0,.12) !important;
  box-shadow: 0 12px 24px rgba(0,0,0,.08);
  transform: translateY(-1px);
  opacity: 1;
}

.admin-tabs .btn-primary{
  border: 0 !important;
  color: #fff !important;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%) !important;
  box-shadow: 0 10px 22px rgba(17,24,39,.16);
}

.admin-tabs .btn-primary:hover{
  color: #fff !important;
  background: linear-gradient(135deg, #111827 0%, #0b1220 100%) !important;
  box-shadow: 0 14px 28px rgba(17,24,39,.22);
}

body.dark .admin-tabs .btn{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.10) !important;
  box-shadow: 0 10px 24px rgba(0,0,0,.24);
}

body.dark .admin-tabs .btn:hover{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.16) !important;
  box-shadow: 0 14px 28px rgba(0,0,0,.30);
}

body.dark .admin-tabs .btn-primary{
  color: #f8fafc !important;
  background: linear-gradient(135deg, #273449 0%, #1b2638 100%) !important;
  box-shadow: 0 12px 26px rgba(0,0,0,.28);
}

body.dark .admin-tabs .btn-primary:hover{
  background: linear-gradient(135deg, #32445f 0%, #223147 100%) !important;
  box-shadow: 0 16px 30px rgba(0,0,0,.34);
}

.admin-tabs .badge{
  position: static !important;
  transform: none !important;
  margin-left: .35rem;
  vertical-align: middle;
}

html[dir="rtl"] .admin-tabs .badge{
  margin-left: 0;
  margin-right: .35rem;
}

/* =========================================================
   TABLES
========================================================= */

.table-wrap{
  overflow:auto;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 10px 28px rgba(0,0,0,.06);
}

body.dark .table-wrap{
  box-shadow: 0 18px 44px rgba(0,0,0,.45);
}

.table{
  width:100%;
  border-collapse: collapse;
  min-width: 760px;
  color: var(--text);
  margin: 0;
}

.table th,
.table td{
  border: none;
  border-bottom: 1px solid rgba(0,0,0,.05);
  padding: 12px 12px;
  vertical-align: top;
}

body.dark .table th,
body.dark .table td{
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.table thead th{
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 2;
  text-align:left;
  font-size: 13px;
  color: var(--muted);
  font-weight: 650;
}

html[dir="rtl"] .table thead th{
  text-align: right;
}

.table tbody tr{
  transition: background .12s ease;
}

.table tbody tr:nth-child(even){
  background: rgba(0,0,0,.012);
}

body.dark .table tbody tr:nth-child(even){
  background: rgba(255,255,255,.03);
}

.table tbody tr:hover{
  background: rgba(99,102,241,.05);
}

body.dark .table tbody tr:hover{
  background: rgba(56,189,248,.06);
}

.table a{
  text-decoration: none;
}

.table a:hover{
  text-decoration: underline;
  opacity: 1;
}

.td-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content: flex-start;
}

html[dir="rtl"] .td-actions{
  justify-content: flex-end;
}

.td-actions .btn{
  white-space: nowrap;
}

/* =========================================================
   ADMIN SECTION CARD + TABLE
========================================================= */

.admin-section{
  border-radius: 18px;
  background: var(--card);
}

.admin-section.card{
  box-shadow: 0 14px 34px rgba(0,0,0,.08);
  overflow: hidden;
}

body.dark .admin-section.card{
  box-shadow: 0 22px 52px rgba(0,0,0,.50);
}

.card-header{
  background: transparent !important;
  border-bottom: 1px solid var(--line) !important;
  padding: 12px 14px;
  font-weight: 800;
}

.admin-section .table-wrap{
  border-radius: 0 !important;
  overflow: auto;
  background: transparent !important;
  box-shadow: none;
}

.admin-section .table{
  width: 100% !important;
  min-width: 0 !important;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-section .table thead th{
  background: rgba(0,0,0,.02);
  border-bottom: 1px solid rgba(0,0,0,.06);
  font-weight: 700;
}

body.dark .admin-section .table thead th{
  background: rgba(255,255,255,.05);
  border-bottom-color: rgba(255,255,255,.10);
}

.admin-section .table th,
.admin-section .table td{
  border-bottom-color: rgba(0,0,0,.06);
}

body.dark .admin-section .table th,
body.dark .admin-section .table td{
  border-bottom-color: rgba(255,255,255,.10);
}

.admin-section .table tbody tr:hover{
  background: rgba(13,110,253,.05);
}

body.dark .admin-section .table tbody tr:hover{
  background: rgba(56,189,248,.07);
}

.dashboard-table{
  border-radius: 18px;
  overflow: hidden;
}

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

.th-sort{
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.th-sort .sort-icon{
  opacity: .45;
  font-size: 12px;
  margin-inline-start: 6px;
}

.th-sort[data-dir="asc"] .sort-icon,
.th-sort[data-dir="desc"] .sort-icon{
  opacity: 1;
}