/* === CARD === */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
  animation: cardIn 0.4s var(--ease) both;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-radius: var(--radius) var(--radius) 0 0;
  background: #fafbfc;
}

.card-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text);
}

.card-body { padding: 18px; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: .45rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .8125rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              box-shadow var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  line-height: 1.5;
  text-decoration: none !important;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--orange);
  border-color: #E55F00;
  color: var(--orange-text);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(255,107,0,0.28);
}
.btn-primary:hover {
  background: var(--orange-hover);
  border-color: #D45500;
  color: var(--orange-text);
  box-shadow: 0 4px 14px var(--orange-shadow);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  box-shadow: 0 1px 3px rgba(16,185,129,0.25);
}
.btn-success:hover {
  filter: brightness(0.92);
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: 0 1px 3px rgba(239,68,68,0.25);
}
.btn-danger:hover {
  filter: brightness(0.92);
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--warning);
  border-color: var(--warning);
  color: #fff;
  box-shadow: 0 1px 3px rgba(245,158,11,0.25);
}
.btn-warning:hover {
  filter: brightness(0.92);
  box-shadow: 0 4px 12px rgba(245,158,11,0.3);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--primary-bg);
  border: 1px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary-100);
  border-color: var(--primary-hover);
  color: var(--primary-hover);
  box-shadow: 0 1px 4px rgba(37,99,235,0.18);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-icon { padding: .375rem; }
.btn-sm   { padding: .25rem .7rem; font-size: .75rem; border-radius: var(--radius-xs); }
.btn-lg   { padding: .625rem 1.375rem; font-size: .9rem; }

/* WP aliases */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: .45rem 1.1rem; border-radius: var(--radius-sm); font-size: .8125rem;
  font-weight: 500; border: 1px solid var(--primary); cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap; line-height: 1.5; text-decoration: none !important;
  background: var(--primary-bg); color: var(--primary);
}
.button:hover { background: var(--primary-100); border-color: var(--primary-hover); color: var(--primary-hover); }

.button-primary {
  background: var(--orange); border-color: #E55F00; color: var(--orange-text);
  font-weight: 700; box-shadow: 0 1px 3px rgba(255,107,0,0.28);
}
.button-primary:hover {
  background: var(--orange-hover); border-color: #D45500; color: var(--orange-text);
  box-shadow: 0 4px 14px var(--orange-shadow);
}

/* === BADGE === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .22rem .7rem;
  border-radius: var(--radius-pill);
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fff7ed; color: #c2410c; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #cffafe; color: #155e75; }
.badge-gold    { background: #fff7ed; color: #c2410c; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* === FORM === */
.form-group { margin-bottom: 1.125rem; }

.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: .4rem;
}

.form-label .req { color: var(--danger); }

.form-control {
  width: 100%;
  padding: .55rem .875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text);
  background: var(--card);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.form-control::placeholder { color: #94a3b8; }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.1); }

.form-error {
  font-size: .8rem;
  color: var(--danger);
  margin-top: .3rem;
  display: none;
}
.form-error.show { display: block; }

.price-unit {
  display: block;
  font-size: .72rem;
  color: var(--text-3);
  margin-top: .2rem;
  letter-spacing: .01em;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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 .7rem center;
  padding-left: 2.5rem;
  cursor: pointer;
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .875rem;
  user-select: none;
}
.form-check input { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

.form-radio-group { display: flex; gap: 1.5rem; flex-wrap: wrap; }

.form-control-sm { padding: .3rem .6rem; font-size: .8rem; }

.form-row   { display: grid; gap: 1rem; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* === TABLE === */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: .8125rem;
}

thead th {
  padding: .75rem 1.125rem;
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: .05em;
  text-transform: uppercase;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

tbody td {
  padding: .875rem 1.125rem;
  color: var(--text);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  transition: background var(--transition-fast);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(odd)  { background: #ffffff; }
tbody tr:nth-child(even) { background: #fafbfd; }
tbody tr:hover           { background: #f0f7ff; }
tbody tr.selected        { background: #dbeafe; }
tbody tr.selected:hover  { background: #bfdbfe; }

.table-actions { display: flex; gap: .3rem; align-items: center; }

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-3);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto .875rem; opacity: .25; }
.empty-state p   { font-size: .875rem; }

/* === STAT CARDS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.375rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none !important;
  transition: box-shadow var(--transition), transform var(--transition);
  animation: cardIn 0.4s var(--ease) both;
}

.stats-grid .stat-card:nth-child(1) { animation-delay: 0.04s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.08s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.12s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.16s; }

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }

.stat-body { flex: 1; min-width: 0; }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-label {
  font-size: .75rem;
  color: var(--text-3);
  font-weight: 500;
  margin-top: .25rem;
}

.stat-value .num {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 50%, rgba(255,255,255,0) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.stat-card:hover::before { opacity: 1; }

.stat-icon {
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.stat-card:hover .stat-icon {
  transform: scale(1.08) rotate(-4deg);
}

/* Legacy aliases */
.stat-card-top   { display: flex; align-items: flex-start; justify-content: space-between; }

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.open { display: flex; }
.modal-overlay[style*="flex"] { display: flex !important; }

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 92%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.2s var(--ease);
  border: 1px solid var(--border);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: #fafbfc;
}

.modal-title { font-size: .9375rem; font-weight: 600; color: var(--text); }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  padding: .3rem;
  border-radius: var(--radius-xs);
  display: flex;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body   { padding: 20px; overflow-y: auto; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .625rem;
  flex-shrink: 0;
  background: #fafbfc;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* === CONFIRM DIALOG === */
.confirm-icon {
  width: 52px;
  height: 52px;
  background: var(--danger-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: var(--danger);
  box-shadow: 0 0 0 8px rgba(239,68,68,0.08);
}

/* === TOAST === */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: .5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .875rem 1.125rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: .8125rem;
  color: var(--text);
  min-width: 240px;
  max-width: 360px;
  animation: slideUp 0.25s var(--ease) both;
  transition: opacity .3s;
  pointer-events: auto;
}
.toast.hiding { opacity: 0; }
.toast svg    { width: 16px; height: 16px; flex-shrink: 0; }

.toast-success { border-right: 4px solid var(--success); background: #fafffe; }
.toast-error   { border-right: 4px solid var(--danger);  background: #fffafa; }
.toast-warning { border-right: 4px solid var(--warning); background: #fffdf5; }
.toast-info    { border-right: 4px solid var(--primary); background: #f8fbff; }

/* === FILTER BAR === */
.filter-bar {
  display: flex;
  align-items: center;
  gap: .625rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-bar .form-control {
  width: auto;
  min-width: 140px;
  flex: 0 0 auto;
}

.search-input { position: relative; }
.search-input svg {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-3);
  pointer-events: none;
}
.search-input input { padding-right: 2.25rem; }

/* === TABS === */
.tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.375rem;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: .6rem 1.125rem;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-panel         { display: none; }
.tab-panel.active  { display: block; animation: fadeIn 0.2s ease both; }

.mod-row-disabled { opacity: .5; }
.mod-row-disabled .mod-qty { pointer-events: none; }

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

