/* ===== CSS Variables ===== */
:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: #6b7280;
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --create-color: #f97316;
  --create-hover: #ea580c;
  --info-color: #3b82f6;
  --bg-color: #f3f4f6;
  --card-bg: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --sidebar-bg: #1f2937;
  --sidebar-text: #d1d5db;
  --sidebar-active: #374151;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
}

/* ===== Reset & Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
}

/* ===== Layout ===== */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
.sidebar .logo {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar .logo h2 {
  font-size: 18px;
  color: #fff;
  font-weight: 600;
}
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.menu-toggle:hover {
  background: rgba(255,255,255,0.1);
}
.nav-menu { padding: 8px 0; flex: 1; }
.nav-group { margin-bottom: 2px; }
.nav-group.active .nav-item { background: var(--sidebar-active); color: #fff; }
.nav-group.active .arrow { transform: rotate(90deg); }
.nav-group.active .submenu { display: block; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}
.nav-item:hover { background: var(--sidebar-active); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }
.nav-item .text { flex: 1; font-size: 14px; }
.nav-item .arrow { font-size: 10px; transition: transform 0.2s; }
.submenu { display: none; padding: 4px 0 4px 46px; }
.submenu-item {
  display: block;
  padding: 8px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
}
.submenu-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.user-info {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-info .avatar { font-size: 22px; }
.user-info .info { flex: 1; }
.user-info .name { font-size: 14px; color: #fff; font-weight: 500; }
.user-info .role { font-size: 12px; color: var(--sidebar-text); }

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.header {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}
.breadcrumb { font-size: 16px; font-weight: 600; }
.header-actions { display: flex; gap: 6px; }

/* ===== Tabs ===== */
.tabs-container {
  height: 40px;
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 12px;
  flex-shrink: 0;
}
.tabs-wrapper { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  background: #f3f4f6;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  border-bottom: none;
  user-select: none;
}
.tab.active {
  background: var(--bg-color);
  border-color: var(--border-color);
  color: var(--primary-color);
  font-weight: 500;
}
.tab-icon { font-size: 13px; }
.tab-text { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  margin-left: 2px;
}
.tab-close:hover { background: rgba(0,0,0,0.08); }
.tabs-actions { display: flex; gap: 4px; }

/* ===== Content ===== */
.content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  background: var(--bg-color);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Dashboard & Cards ===== */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 16px 18px; }

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}
.stat-item {
  background: #fff;
  padding: 16px;
  border-radius: var(--radius);
  text-align: center;
  border: 1px solid var(--border-color);
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 4px;
}
.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Quick Actions ===== */
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--create-color);
  border: 1px solid var(--create-color);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  color: #fff;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.quick-btn:hover {
  background: var(--create-hover);
  border-color: var(--create-hover);
  transform: translateY(-1px);
}
.quick-btn .icon { font-size: 18px; }

/* ===== Page Toolbar ===== */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; gap: 8px; align-items: center; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-header h2 { font-size: 18px; font-weight: 600; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
  color: var(--text-primary);
  border-color: var(--border-color);
  line-height: 1.5;
}
.btn:hover { background: #f9fafb; }
.btn-primary {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-create {
  background: var(--create-color);
  color: #fff;
  border-color: var(--create-color);
}
.btn-create:hover { background: var(--create-hover); }
.btn-secondary {
  background: #f3f4f6;
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger {
  background: var(--danger-color);
  color: #fff;
  border-color: var(--danger-color);
}
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-calculate {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  color: #fff;
  border: none;
  width: 100%;
  padding: 12px;
  font-size: 15px;
}
.btn-calculate:hover { filter: brightness(0.88); }
.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: #f3f4f6; }
.btn-icon-sm {
  width: 28px; height: 28px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border-color);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}
.btn-icon-sm:hover { background: #f3f4f6; color: var(--text-primary); }
.btn-close {
  width: 32px; height: 32px;
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-close:hover { color: var(--danger-color); }

/* ===== Tables ===== */
.table-container {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.data-table th {
  background: #f9fafb;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
}
.data-table tbody tr:hover { background: #f9fafb; }
.data-table td .action-btns {
  display: flex;
  gap: 4px;
  justify-content: flex-start;
}

/* ===== Status Tags & Badges ===== */
.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.status-tag.status-pending { background: #fef3c7; color: #92400e; }
.status-tag.status-processing { background: #dbeafe; color: #1e40af; }
.status-tag.status-complete { background: #d1fae5; color: #065f46; }
.status-tag.status-incomplete { background: #fee2e2; color: #991b1b; }
.status-tag.status-cancelled { background: #f3f4f6; color: #4b5563; }
.status-tag.status-refunded { background: #fce7f3; color: #9d174d; }
.status-tag.status-transferred { background: #e0e7ff; color: #3730a3; }
.status-tag.status-warning { background: #fef3c7; color: #92400e; }
.status-tag.status-urgent { background: #fee2e2; color: #991b1b; }
.status-tag.status-auditing { background: #dbeafe; color: #1e40af; }
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.status-badge.passed { background: #d1fae5; color: #065f46; }
.status-badge.pending { background: #fef3c7; color: #92400e; }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.badge-danger {
  background: var(--danger-color);
  color: #fff;
}

/* ===== Level Badges (1-11) ===== */
.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.level-1 { background: #f3f4f6; color: #374151; }
.level-2 { background: #dbeafe; color: #1e40af; }
.level-3 { background: #d1fae5; color: #065f46; }
.level-4 { background: #fef3c7; color: #92400e; }
.level-5 { background: #fee2e2; color: #991b1b; }
.level-6 { background: #fce7f3; color: #9d174d; }
.level-7 { background: #e0e7ff; color: #3730a3; }
.level-8 { background: #cffafe; color: #155e75; }
.level-9 { background: #dcfce7; color: #166534; }
.level-10 { background: #ffedd5; color: #9a3412; }
.level-11 { background: #fae8ff; color: #86198f; }

/* ===== Forms ===== */
.form-container { max-width: 900px; margin: 0 auto; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.form-section { margin-bottom: 24px; }
.form-section h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.form-group label .required { color: var(--danger-color); margin-left: 2px; }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  background: #fff;
  color: var(--text-primary);
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* ===== Product / Coupon / User Forms ===== */
.product-form, .coupon-form, .user-form {
  background: #fff;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ===== Search & Dropdown ===== */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box input {
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 13px;
  width: 220px;
  outline: none;
}
.search-box::before {
  content: "🔍";
  position: absolute;
  left: 10px;
  font-size: 12px;
  opacity: 0.5;
}
.search-dropdown-wrapper { position: relative; }
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 4px;
  display: none;
}
.search-dropdown.active { display: block; }
.search-dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
}
.search-dropdown-item:last-child { border-bottom: none; }
.search-dropdown-item:hover { background: #f9fafb; }
.search-dropdown-item .name { font-weight: 500; font-size: 14px; }
.search-dropdown-item .info { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ===== Upload Area ===== */
.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-area.drag-over { border-color: var(--primary-color); background: #eef2ff; }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.upload-icon { font-size: 28px; }
.upload-preview img { max-width: 200px; max-height: 150px; border-radius: var(--radius); border: 1px solid var(--border-color); }
.file-upload-icon { font-size: 32px; margin-bottom: 4px; }
.file-upload-text { font-size: 14px; color: var(--text-secondary); }

/* ===== Modals ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-content {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ===== Custom Alert ===== */
.custom-alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  animation: fadeIn 0.2s ease;
}
.custom-alert-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s ease;
}
.custom-alert-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.custom-alert-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}
.custom-alert-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}
.custom-alert-btn {
  padding: 8px 28px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
}
.custom-alert-btn:hover { background: var(--primary-hover); }
.custom-confirm-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.custom-confirm-btn {
  padding: 8px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  border: 1px solid transparent;
}
.custom-confirm-btn.primary {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.custom-confirm-btn.secondary {
  background: #f3f4f6;
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* ===== Switch / Toggle ===== */
.switch-toggle {
  position: relative;
  width: 56px;
  height: 26px;
  background: #e5e7eb;
  border-radius: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: background 0.2s;
}
.switch-toggle input {
  opacity: 0;
  width: 0; height: 0;
  position: absolute;
}
.switch-toggle:has(input:checked),
.switch-toggle.active { background: var(--primary-color); }
.switch-slider {
  position: absolute;
  top: 2px; left: 2px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  overflow: hidden;
}
.switch-toggle:has(input:checked) .switch-slider,
.switch-toggle.active .switch-slider { transform: translateX(30px); }
.switch-label-on, .switch-label-off {
  position: absolute;
  font-size: 10px;
  font-weight: 500;
  color: #fff;
  user-select: none;
}
.switch-label-on { left: 8px; opacity: 0; }
.switch-label-off { right: 8px; opacity: 1; color: #6b7280; }
.switch-toggle:has(input:checked) .switch-label-on,
.switch-toggle.active .switch-label-on { opacity: 1; }
.switch-toggle:has(input:checked) .switch-label-off,
.switch-toggle.active .switch-label-off { opacity: 0; }

/* Alternative switch-btn for player levels */
.switch-group { display: flex; gap: 8px; flex-wrap: wrap; }
.switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  background: #fff;
  color: var(--text-secondary);
  transition: all 0.2s;
  user-select: none;
}
.switch-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.switch-btn input { margin: 0; }

/* ===== Range Slider ===== */
.level-range-slider { padding: 10px 0; }
.range-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.range-track {
  position: relative;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
}
.range-fill {
  position: absolute;
  height: 100%;
  background: var(--primary-color);
  border-radius: 3px;
}
.range-thumb {
  position: absolute;
  width: 18px; height: 18px;
  background: white;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  top: -6px;
  transform: translateX(-50%);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ===== Checkbox Lists ===== */
.coupon-checkbox-list {
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.coupon-checkbox-item,
.product-checkbox-item,
.customer-checkbox-item {
  display: flex;
  align-items: center;
  padding: 6px 0;
  cursor: pointer;
  font-size: 13px;
  gap: 6px;
}
.coupon-checkbox-item input,
.product-checkbox-item input,
.customer-checkbox-item input {
  width: 14px; height: 14px;
  flex-shrink: 0;
}

/* ===== Timed Player Rows ===== */
.timed-player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}
.timed-player-row:last-child { border-bottom: none; }
.timed-player-select, .timed-product-select {
  flex: 1;
  min-width: 90px;
  padding: 5px 6px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.timed-duration, .timed-unit-price, .timed-item-amount {
  width: 70px;
  padding: 5px 6px;
  font-size: 13px;
  text-align: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.timed-item-amount { background: #e0f2fe; font-weight: 500; }

/* ===== Edit Timed Rows ===== */
.edit-timed-row {
  display: grid;
  grid-template-columns: 1fr 1fr 80px 120px;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  align-items: end;
}
.edit-timed-unit-price, .edit-timed-duration {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}
.edit-timed-player-id, .edit-timed-player-name,
.edit-timed-product-id, .edit-timed-product-name { display: none; }

/* ===== Selected Players ===== */
.selected-players {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 40px;
  background: var(--bg-color);
  border-radius: var(--radius);
  padding: 8px;
}
.selected-player-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--primary-color);
  color: #fff;
  border-radius: 16px;
  font-size: 13px;
}
.selected-player-tag .remove {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0.8;
}
.selected-player-tag .remove:hover { opacity: 1; }

/* ===== Settlement & Checkboxes ===== */
.settlement-checkbox,
.player-select-all,
.player-header-checkbox,
.order-checkbox,
.player-level-checkbox,
.edit-player-level-checkbox {
  width: 16px; height: 16px;
  cursor: pointer;
}

/* ===== After Sales ===== */
.after-sales-list { display: flex; flex-direction: column; gap: 10px; }
.after-sales-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #f9fafb;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
  border-left: 3px solid var(--warning-color);
}
.after-sales-item:hover { background: #f3f4f6; }
.after-sales-item .info { display: flex; flex-direction: column; gap: 2px; }
.after-sales-item .order-no { font-weight: 600; font-size: 13px; }
.after-sales-item .reason { font-size: 12px; color: var(--text-secondary); }

/* ===== Calculation Result ===== */
.calculation-result {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
  color: #fff;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: rgba(255,255,255,0.92);
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.result-row:last-child { border-bottom: none; }
.result-row .value { font-weight: 600; color: #fff; }
.result-row .value.highlight { color: #fde047; font-size: 16px; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }

/* ===== Order Info Summary ===== */
.order-info-summary {
  background: var(--bg-color);
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

/* ===== Info Section ===== */
.info-section {
  background: var(--bg-color);
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

/* ===== Logs ===== */
.log-list { display: flex; flex-direction: column; gap: 6px; }
.log-item {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: #f9fafb;
  align-items: flex-start;
}
.log-item.info { border-left: 3px solid var(--info-color); }
.log-item.warn, .log-item.warning { border-left: 3px solid var(--warning-color); }
.log-item.error { border-left: 3px solid var(--danger-color); }
.log-time { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.log-level {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  background: #e5e7eb;
  white-space: nowrap;
}
.log-item.info .log-level { background: #dbeafe; color: #1e40af; }
.log-item.warn .log-level, .log-item.warning .log-level { background: #fef3c7; color: #92400e; }
.log-item.error .log-level { background: #fee2e2; color: #991b1b; }
.log-message { flex: 1; word-break: break-all; }

/* ===== Filter Group ===== */
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group select,
.filter-group input {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
}

/* ===== States ===== */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}
.loading {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}
.error {
  text-align: center;
  padding: 30px 20px;
  color: var(--danger-color);
  font-size: 14px;
}
.highlight { color: var(--primary-color); font-weight: 600; }

/* ===== Action Buttons Container ===== */
.action-btns { display: flex; gap: 4px; align-items: center; }

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== Readonly / Disabled ===== */
input[readonly], select[readonly], textarea[readonly],
input:disabled, select:disabled, textarea:disabled {
  background-color: #e5e7eb !important;
  color: #6b7280 !important;
  cursor: not-allowed;
  border-color: #d1d5db !important;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  body { font-size: 15px; }
  .app-container { flex-direction: column; height: auto; overflow: visible; }
  .sidebar {
    width: 100%;
    height: auto;
    display: block;
    flex-shrink: 0;
    overflow: hidden;
    padding: 0;
  }
  .sidebar.open { overflow-y: auto; }
  .sidebar .logo {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    width: 100%;
  }
  .sidebar .logo h2 { font-size: 16px; }
  .menu-toggle { display: block; }
  .nav-menu {
    display: none;
    width: 100%;
    padding: 8px 0;
  }
  .sidebar.open .nav-menu {
    display: block;
  }
  .sidebar .user-info { display: none; }
  .main-content { width: 100%; height: auto; overflow: visible; }
  .header { padding: 10px 12px; }
  .tabs-container { padding: 0 12px; }
  .tab { padding: 8px 12px; font-size: 13px; }
  .content-wrapper { padding: 12px; }
  .dashboard { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .page-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar-left, .toolbar-right { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .table-container { overflow-x: auto; }
  .data-table { min-width: 640px; font-size: 14px; }
  .data-table th, .data-table td { padding: 8px; white-space: nowrap; }
  .modal-overlay { padding: 8px; align-items: flex-end; }
  .modal-content { max-height: 95vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-header, .modal-body, .modal-footer { padding: 12px 16px; }
  .search-box input { width: 100%; }
  .btn { padding: 10px 16px; font-size: 15px; }
  .btn-sm { padding: 8px 12px; font-size: 14px; }
  .quick-actions { gap: 8px; }
  .quick-btn { flex: 1 1 calc(50% - 8px); justify-content: center; padding: 14px 8px; font-size: 14px; }
  .form-container { max-width: 100%; padding: 0; }
  .card-header, .card-body { padding: 12px 14px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .search-dropdown-wrapper { width: 100%; }
  .search-dropdown { width: 100%; }
}
