* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #333;
  background: #f0f2f5;
  line-height: 1.6;
}

/* ============ Login Page ============ */
.admin-login-page {
  display: flex;
  min-height: 100vh;
}

.login-left {
  flex: 1;
  background: linear-gradient(135deg, #1a56db 0%, #3b82f6 50%, #60a5fa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.08) 0%, transparent 50%);
}

.login-brand {
  position: relative;
  z-index: 1;
  color: #fff;
  max-width: 420px;
}

.brand-logo {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
}

.brand-title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
}

.brand-desc {
  font-size: 16px;
  line-height: 1.8;
  opacity: 0.85;
  margin-bottom: 40px;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  opacity: 0.9;
}

.feature-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  flex-shrink: 0;
}

.login-right {
  width: 480px;
  flex-shrink: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-form-wrap {
  width: 100%;
  max-width: 360px;
}

.form-header {
  margin-bottom: 36px;
}

.form-title {
  font-size: 26px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 8px;
}

.form-subtitle {
  font-size: 14px;
  color: #9ca3af;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.field-input {
  padding: 12px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #f9fafb;
}

.field-input:focus {
  border-color: #1a56db;
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
  background: #fff;
}

.field-input::placeholder {
  color: #9ca3af;
}

.login-submit-btn {
  padding: 14px;
  background: #1a56db;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 8px;
}

.login-submit-btn:hover {
  background: #1547b0;
}

.login-submit-btn:active {
  transform: scale(0.98);
}

.login-hint {
  font-size: 13px;
  color: #9ca3af;
  text-align: center;
  margin-top: 4px;
}

/* ============ Admin Panel Layout ============ */
.admin-panel {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  background: #1f2937;
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-logo {
  padding: 20px 24px;
  font-size: 20px;
  font-weight: 700;
  border-bottom: 1px solid #374151;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid #374151;
}

.sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1a56db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-name {
  font-size: 14px;
  font-weight: 500;
}

.sidebar-role {
  font-size: 12px;
  color: #9ca3af;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 12px 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #4b5563 transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.sidebar-link.active {
  color: #fff;
  background: rgba(26,86,219,0.2);
  border-left-color: #1a56db;
}

.sidebar-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.sidebar-group-toggle:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.sidebar-group-toggle.has-active {
  color: #fff;
  background: rgba(255,255,255,0.04);
}

.sidebar-caret {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.2s;
  transform: rotate(-90deg);
}

.sidebar-group.open .sidebar-caret {
  transform: rotate(0deg);
}

.sidebar-submenu {
  display: none;
}

.sidebar-group.open .sidebar-submenu {
  display: block;
}

.sidebar-sublink {
  padding-left: 54px;
  font-size: 13px;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid #374151;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-footer a {
  color: #9ca3af;
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

.sidebar-footer a:hover {
  color: #fff;
}

/* Main Content */
.admin-main {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
}

.admin-header {
  background: #fff;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 40;
}

.admin-page-title {
  font-size: 18px;
  font-weight: 600;
}

.admin-time {
  font-size: 13px;
  color: #888;
}

.admin-content {
  padding: 24px 32px;
  flex: 1;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

/* Stat Cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-number {
  font-size: 32px;
  font-weight: 700;
  color: #1a56db;
}

.stat-label {
  font-size: 14px;
  color: #888;
  margin-top: 4px;
}

.dashboard-block {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.block-title {
  font-size: 16px;
  font-weight: 600;
  padding: 20px 24px 0;
}

.block-body {
  padding: 16px 24px 24px;
}

.block-desc {
  padding: 8px 24px 0;
  font-size: 13px;
  color: #888;
}

.hot-push-block {
  margin-top: 20px;
}

.hot-push-block .checkbox-group {
  padding: 16px 24px 0;
}

.hot-push-actions {
  display: flex;
  gap: 10px;
  padding: 16px 24px 24px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}

.recent-item:last-child {
  border-bottom: none;
}

.recent-name {
  font-size: 14px;
  font-weight: 500;
}

.recent-city {
  font-size: 13px;
  color: #888;
}

/* Toolbar */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.toolbar-search {
  padding: 10px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  width: 280px;
  transition: border-color 0.2s;
}

.toolbar-search:focus {
  border-color: #1a56db;
}

.toolbar-btn {
  padding: 10px 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  background: #fff;
  transition: all 0.2s;
}

.toolbar-btn.primary {
  background: #1a56db;
  color: #fff;
  border-color: #1a56db;
}

.toolbar-btn.primary:hover {
  background: #1547b0;
}

.toolbar-btn:hover {
  border-color: #1a56db;
  color: #1a56db;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Table */
.table-wrap {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  background: #f9fafb;
  padding: 12px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.admin-table tr:hover {
  background: #f9fafb;
}

.table-logo {
  font-size: 24px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 6px;
  overflow: hidden;
}

.table-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.recent-name img {
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 4px;
  vertical-align: middle;
}

.logo-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-preview {
  width: 48px;
  height: 48px;
  border: 2px dashed #ddd;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.logo-upload-btn {
  padding: 6px 14px;
  background: #f3f4f6;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 12px;
  color: #555;
  cursor: pointer;
  transition: background 0.2s;
  align-self: flex-start;
}

.logo-upload-btn:hover {
  background: #e5e7eb;
}

.logo-hint {
  font-size: 12px;
  color: #888;
}

.table-services {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.table-service-tag {
  padding: 2px 8px;
  background: #e8f0fe;
  color: #1a56db;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.city-tooltip {
  position: fixed;
  z-index: 10000;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  padding: 0;
  min-width: 200px;
  max-width: 360px;
  font-family: inherit;
  animation: cityTipIn 0.15s ease-out;
}

@keyframes cityTipIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.city-tip-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1a56db;
  border-bottom: 1px solid #f0f0f0;
}

.city-tip-icon {
  font-size: 14px;
}

.city-tip-row {
  padding: 6px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
}

.city-tip-row:last-child {
  padding-bottom: 10px;
}

.city-tip-prov {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}

.city-tip-sep {
  font-size: 11px;
  color: #d1d5db;
  margin: 0 2px;
}

.city-tip-city {
  font-size: 13px;
  color: #374151;
}

.city-tip-dists {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
  padding-left: 8px;
  margin-top: 2px;
}

.city-tip-dist {
  display: inline-block;
  padding: 2px 8px;
  background: #f0f4ff;
  color: #3b6de0;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.4;
}

.table-service-tag[data-cities] {
  cursor: pointer;
}

.table-service-tag[data-cities]:hover {
  background: #d4e2fc;
}

.badge-certified {
  display: inline-block;
  padding: 2px 8px;
  background: #d1fae5;
  color: #059669;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.badge-promo {
  display: inline-block;
  padding: 2px 8px;
  background: #fef3c7;
  color: #d97706;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.badge-uncertified {
  display: inline-block;
  padding: 2px 8px;
  background: #f3f4f6;
  color: #999;
  border-radius: 10px;
  font-size: 12px;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 4px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  background: #fff;
  transition: all 0.2s;
}

.action-btn:hover {
  border-color: #1a56db;
  color: #1a56db;
}

.action-btn.danger {
  color: #ef4444;
  border-color: #fca5a5;
}

.action-btn.danger:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

/* Service Type Tree */
.service-type-grid {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 16px 20px;
}

.svc-tree-row {
  border-bottom: 1px solid #f3f4f6;
}

.svc-tree-row:last-child {
  border-bottom: none;
}

.svc-tree-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  flex-wrap: wrap;
}

.svc-tree-toggle {
  width: 20px;
  text-align: center;
  cursor: pointer;
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
  user-select: none;
}

.svc-tree-toggle-spacer {
  width: 20px;
  flex-shrink: 0;
}

.svc-tree-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.svc-tree-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.svc-tree-depth-1 .svc-tree-name,
.svc-tree-depth-2 .svc-tree-name {
  font-weight: 500;
  font-size: 13px;
}

.svc-tree-depth-2 .svc-tree-name {
  font-weight: 400;
  font-size: 13px;
  color: #555;
}

.svc-tree-count {
  font-size: 12px;
  color: #999;
  margin-left: 4px;
}

.svc-tree-row-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.svc-tree-children-wrap {
  padding-left: 28px;
  border-left: 2px solid #e5e7eb;
  margin-left: 9px;
  margin-bottom: 4px;
}

.svc-tree-depth-1 .svc-tree-children-wrap {
  padding-left: 24px;
}

/* Merchant form service tree */
.svc-tree-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
}

.svc-tree-l1 {
  margin-bottom: 8px;
}

.svc-tree-l1:last-child {
  margin-bottom: 0;
}

.svc-tree-l1-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.svc-tree-l2 {
  margin-bottom: 4px;
  margin-left: 8px;
}

.svc-tree-l2-label {
  font-size: 13px;
  font-weight: 500;
  color: #555;
  margin-bottom: 2px;
}

.svc-tree-l3-wrap {
  margin-left: 8px;
}

.svc-tree-leaf {
  display: inline-flex;
  margin: 2px 4px 2px 0;
  font-size: 12px;
}

/* Hot push groups */
.hot-push-group {
  margin-bottom: 12px;
}

.hot-push-group-label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.hot-push-group-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

/* Region Tree */
.region-tree {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.region-province {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow: hidden;
}

.region-province-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.region-province-header:hover {
  background: #f9fafb;
}

.region-province-name {
  font-size: 16px;
  font-weight: 600;
}

.region-province-meta {
  font-size: 13px;
  color: #888;
}

.region-province-actions {
  display: flex;
  gap: 6px;
}

.region-children {
  padding: 0 20px 16px;
  display: none;
}

.region-children.open {
  display: block;
}

.region-city {
  border-top: 1px solid #f3f4f6;
  padding-top: 12px;
  margin-top: 4px;
}

.region-city-name {
  font-size: 14px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.region-district-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.region-district {
  background: #f3f4f6;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.region-district-towns {
  font-size: 11px;
  color: #888;
}

.region-city-label {
  display: flex;
  align-items: center;
}

.region-row-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.region-district .region-row-actions {
  margin-left: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.region-district:hover .region-row-actions {
  opacity: 1;
}

.region-district .action-btn {
  padding: 2px 8px;
  font-size: 11px;
}

.region-city-empty,
.region-district-empty {
  color: #999;
  font-size: 13px;
  background: #f9fafb;
}

.toolbar-hint {
  font-size: 13px;
  color: #888;
  margin-left: 4px;
}

.placeholder-text {
  color: #999;
  font-size: 14px;
  padding: 24px;
  text-align: center;
}

/* Permission checkboxes */
.perm-check {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #1a56db;
}

.role-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.role-super {
  background: #fef3c7;
  color: #d97706;
}

.role-editor {
  background: #dbeafe;
  color: #2563eb;
}

.role-viewer {
  background: #f3f4f6;
  color: #666;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  padding: 32px;
}

.admin-modal .modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.admin-modal .modal-close:hover {
  background: #f3f4f6;
  color: #333;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-form label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
  display: block;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
  border-color: #1a56db;
}

.modal-form textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-input:focus {
  border-color: #1a56db;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.checkbox-item.checked {
  background: #e8f0fe;
  color: #1a56db;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.modal-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid #ddd;
  background: #fff;
  transition: all 0.2s;
}

.modal-btn:hover {
  border-color: #1a56db;
}

.modal-btn.primary {
  background: #1a56db;
  color: #fff;
  border-color: #1a56db;
}

.modal-btn.primary:hover {
  background: #1547b0;
}

/* Responsive */
@media (max-width: 1024px) {
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .login-left {
    display: none;
  }
  .login-right {
    width: 100%;
  }
}

/* Merchant Review Tabs & Styles */
.merchant-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
}

.merchant-tab {
  padding: 10px 24px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 14px;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}

.merchant-tab:hover {
  color: #333;
}

.merchant-tab.active {
  color: #1a56db;
  border-bottom-color: #1a56db;
  font-weight: 600;
}

.review-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

/* ============ Promotion Stats ============ */
.promo-summary {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.promo-summary .stat-card {
  padding: 18px 12px;
}

.promo-summary .stat-number {
  font-size: 26px;
}

.promo-summary .stat-card.warn .stat-number {
  color: #d97706;
}

.promo-merchant {
  display: flex;
  align-items: center;
  gap: 10px;
}

.promo-merchant-name {
  font-weight: 600;
  color: #222;
  margin-bottom: 2px;
}

.promo-date {
  white-space: nowrap;
  color: #555;
}

.promo-none {
  color: #aaa;
}

.promo-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.promo-status-active { background: #d1fae5; color: #059669; }
.promo-status-pending { background: #dbeafe; color: #2563eb; }
.promo-status-ended { background: #f3f4f6; color: #6b7280; }
.promo-status-none { background: #fef3c7; color: #d97706; }

.promo-remain-zero {
  color: #ef4444;
  font-weight: 700;
}

.promo-empty {
  text-align: center;
  padding: 40px;
  color: #999;
}

.promo-error {
  color: #dc2626;
}

@media (max-width: 1200px) {
  .promo-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}

.badge-pending {
  display: inline-block;
  padding: 2px 8px;
  background: #fef3c7;
  color: #d97706;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.badge-rejected {
  display: inline-block;
  padding: 2px 8px;
  background: #fee2e2;
  color: #ef4444;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.review-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.review-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.review-detail-label {
  font-size: 12px;
  color: #999;
}

.review-detail-value {
  font-size: 14px;
  color: #333;
}

.review-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

.review-approve-btn {
  padding: 10px 24px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.review-approve-btn:hover {
  background: #047857;
}

.review-reject-btn {
  padding: 10px 24px;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.review-reject-btn:hover {
  background: #dc2626;
}

/* ============ City Picker ============ */
.svc-leaf-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.admin-city-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: #f0f7ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.admin-city-btn:hover { background: #dbeafe; }

.admin-city-btn .cp-badge {
  font-size: 12px;
  white-space: nowrap;
}

.admin-city-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  width: 100%;
  padding-left: 0;
}

.reg-city-tag {
  display: inline-block;
  padding: 1px 6px;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 3px;
  font-size: 11px;
}

.city-picker-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.city-picker-modal {
  background: #fff;
  border-radius: 12px;
  width: 680px;
  max-width: 95vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.city-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.city-picker-header h4 { margin: 0; font-size: 16px; }
.city-picker-close {
  background: none; border: none; font-size: 22px; cursor: pointer; color: #999;
  padding: 0 4px;
}
.city-picker-close:hover { color: #333; }

.city-picker-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  max-height: 45vh;
  border-bottom: 1px solid #e5e7eb;
}

.cp-province { margin-bottom: 4px; }
.cp-prov-header, .cp-city-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.cp-prov-header label, .cp-city-header label {
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cp-city-header label { font-weight: normal; }
.cp-city { padding-left: 20px; }
.cp-dist { padding-left: 40px; }
.cp-dist label { font-size: 13px; color: #555; cursor: pointer; display: flex; align-items: center; gap: 4px; padding: 2px 0; }

.cp-toggle {
  cursor: pointer;
  font-size: 10px;
  color: #999;
  width: 16px;
  text-align: center;
  user-select: none;
  flex-shrink: 0;
}
.cp-toggle:hover { color: #333; }

.city-picker-selected {
  padding: 12px 20px;
  max-height: 15vh;
  overflow-y: auto;
  border-bottom: 1px solid #e5e7eb;
}
.cp-selected-title { font-size: 13px; color: #666; margin-bottom: 6px; }
.cp-selected-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.cp-tag {
  display: inline-block;
  padding: 2px 8px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 4px;
  font-size: 11px;
}

.city-picker-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
}
.cp-cancel-btn {
  padding: 8px 20px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.cp-cancel-btn:hover { background: #f9fafb; }
.cp-confirm-btn {
  padding: 8px 20px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.cp-confirm-btn:hover { background: #1d4ed8; }

.svc-date-section {
  margin-top: 6px;
}
.svc-date-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.svc-date-label {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}
.svc-date-row input[type="date"] {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 12px;
  color: #333;
  outline: none;
}
.svc-date-row input[type="date"]:focus {
  border-color: #2563eb;
}
.svc-year-btn {
  padding: 4px 10px;
  border: 1px solid #2563eb;
  border-radius: 4px;
  background: #fff;
  color: #2563eb;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.svc-year-btn:hover {
  background: #2563eb;
  color: #fff;
}
.svc-date-sep {
  font-size: 12px;
  color: #999;
}

/* ============ Service Picker Overlay ============ */
.svc-picker-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.svc-picker-modal {
  background: #fff;
  border-radius: 12px;
  width: 75%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.svc-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.svc-picker-header h4 {
  margin: 0;
  font-size: 16px;
  color: #1f2937;
}
.svc-picker-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #6b7280;
  padding: 0 4px;
}
.svc-picker-close:hover { color: #1f2937; }
.svc-picker-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.svc-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
}
.svc-picker-count {
  font-size: 13px;
  color: #6b7280;
}
.sp-cancel-btn, .sp-confirm-btn {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #d1d5db;
  margin-left: 8px;
}
.sp-cancel-btn {
  background: #fff;
  color: #374151;
}
.sp-cancel-btn:hover { background: #f3f4f6; }
.sp-confirm-btn {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.sp-confirm-btn:hover { background: #1d4ed8; }

.sp-l1 { margin-bottom: 12px; }
.sp-l1-label {
  font-size: 14px;
  color: #1f2937;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sp-l1-children { padding-left: 8px; }
.sp-l1-item {
  border: 1px solid #d1d5db;
  background: #f9fafb;
}
.sp-l1-item:hover { border-color: #60a5fa; background: #eff6ff; }
.sp-l1-item.sp-active { border-color: #3b82f6; background: #dbeafe; }
.sp-l1-item.sp-complete { border-color: #10b981; background: #d1fae5; }
.sp-l1-item .sp-leaf-name { font-size: 14px; font-weight: 600; }

.sp-l2 { margin-bottom: 8px; }
.sp-l2-label {
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 4px;
  font-weight: 500;
}
.sp-l2-children { padding-left: 4px; }
.sp-l2-item {
  border: 1px solid #e5e7eb;
  background: #fafbfc;
}
.sp-l2-item:hover { border-color: #93c5fd; background: #eff6ff; }
.sp-l2-item.sp-active { border-color: #60a5fa; background: #eff6ff; }
.sp-l2-item.sp-complete { border-color: #34d399; background: #ecfdf5; }
.sp-l2-item .sp-leaf-name { font-size: 13px; font-weight: 500; }

.sp-leaf {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
}
.sp-leaf:hover { border-color: #93c5fd; }
.sp-leaf.sp-active { border-color: #60a5fa; background: #eff6ff; }
.sp-leaf.sp-complete { border-color: #34d399; background: #ecfdf5; }

.sp-leaf-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
}
.sp-leaf-check {
  font-size: 16px;
  color: #9ca3af;
  width: 20px;
  text-align: center;
}
.sp-active .sp-leaf-check { color: #2563eb; }
.sp-complete .sp-leaf-check { color: #059669; }
.sp-leaf-name {
  font-size: 13px;
  color: #374151;
  flex: 1;
}
.sp-leaf-done {
  font-size: 11px;
  background: #059669;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
}
.sp-leaf-partial {
  font-size: 11px;
  background: #f59e0b;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
}
.sp-included-badge {
  font-size: 11px;
  background: #e5e7eb;
  color: #6b7280;
  padding: 2px 8px;
  border-radius: 10px;
}
.sp-covered { border-style: dashed; }
.sp-covered:hover { border-color: #e5e7eb; }
.sp-covered .sp-leaf-header { cursor: default; }
.sp-covered .sp-leaf-check { color: #9ca3af; }

.sp-leaf-config {
  padding: 8px 12px 12px;
  border-top: 1px solid #e5e7eb;
  background: #fafbfc;
}
.sp-config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.sp-config-row:last-child { margin-bottom: 0; }
.sp-date-label {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}
.sp-click-label {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}
.svc-click-count {
  width: 120px;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  color: #111827;
  background: #fff;
}
.svc-click-count:focus {
  outline: none;
  border-color: #1a56db;
  box-shadow: 0 0 0 2px rgba(26,86,219,0.12);
}
.sp-city-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ============ Service Summary (in merchant form) ============ */
.svc-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.svc-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 4px;
}
.svc-summary-count {
  font-size: 12px;
  color: #6b7280;
}
.svc-summary-clear-all {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}
.svc-summary-clear-all:hover {
  color: #ef4444;
  border-color: #ef4444;
}
.svc-summary-empty {
  font-size: 12px;
  color: #9ca3af;
  padding: 8px 0;
}
.svc-summary-item {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 10px;
  background: #f9fafb;
}
.svc-summary-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.svc-summary-name {
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
}
.svc-summary-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.svc-summary-move {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}
.svc-summary-move:hover:not(:disabled) {
  color: #3b82f6;
  border-color: #3b82f6;
  background: #eff6ff;
}
.svc-summary-move:disabled {
  opacity: 0.35;
  cursor: default;
}
.svc-summary-edit {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: #3b82f6;
  cursor: pointer;
  transition: all 0.2s;
}
.svc-summary-edit:hover {
  color: #2563eb;
  border-color: #3b82f6;
  background: #eff6ff;
}
.svc-summary-clear-config {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}
.svc-summary-clear-config:hover {
  color: #f59e0b;
  border-color: #f59e0b;
}
.svc-summary-remove {
  background: none;
  border: none;
  font-size: 16px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 4px;
}
.svc-summary-remove:hover { color: #ef4444; }
.svc-summary-detail {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

/* ============ Qualification Badges ============ */
.badge-status-active {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  background: #d1fae5;
  color: #065f46;
  font-weight: 500;
}

.badge-status-inactive {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 500;
}

.badge-color-preview {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
  border: 1px solid rgba(0,0,0,0.1);
}

.form-readonly {
  padding: 8px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  color: #374151;
  min-height: 38px;
  display: flex;
  align-items: center;
}

/* ============ Merchant Form Qualifications ============ */
.mf-qual-list {
  min-height: 36px;
}

.mf-qual-empty {
  font-size: 13px;
  color: #9ca3af;
  padding: 6px 0;
}

.mf-qual-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  margin-bottom: 6px;
}

.mf-qual-name {
  font-size: 13px;
  color: #92400e;
  font-weight: 500;
  flex: 7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mf-qual-date-label {
  font-size: 12px;
  color: #92400e;
  white-space: nowrap;
  flex-shrink: 0;
}

.mf-qual-date {
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  flex: 3;
  min-width: 0;
}

.mf-qual-remove {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.mf-qual-remove:hover {
  color: #dc2626;
}

.mf-qual-picker-list {
  max-height: 300px;
  overflow-y: auto;
}

.mf-qual-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
}

.mf-qual-picker-item:last-child {
  border-bottom: none;
}

.mf-qual-picker-name {
  flex: 1;
  font-size: 14px;
  color: #374151;
}

/* ============ Hazmat CRUD ============ */
.hazmat-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 0;
  flex-wrap: wrap;
}

.hazmat-pagination .page-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.hazmat-pagination .page-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.hazmat-pagination .page-btn.active {
  background: #1a56db;
  color: #fff;
  border-color: #1a56db;
}

.hazmat-pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hazmat-pagination .page-dots {
  padding: 0 4px;
  color: #9ca3af;
  font-size: 13px;
}

.hazmat-pagination .page-info {
  margin-left: 12px;
  font-size: 13px;
  color: #6b7280;
}

.hazmat-sub-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.hazmat-sub-row .form-input {
  flex: 1;
}

.hazmat-sub-row .sub-remove {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #fee2e2;
  color: #dc2626;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.hazmat-sub-row .sub-remove:hover {
  background: #fecaca;
}

.toolbar-select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: #374151;
  outline: none;
  cursor: pointer;
}

.state-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.state-chip {
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.state-chip:hover {
  border-color: #1a56db;
  color: #1a56db;
}

.state-chip.active {
  background: #1a56db;
  border-color: #1a56db;
  color: #fff;
}

.toolbar-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.toolbar-btn.small {
  padding: 4px 12px;
  font-size: 12px;
}

@media (max-width: 768px) {
  .admin-sidebar {
    width: 60px;
  }
  .sidebar-logo, .sidebar-name, .sidebar-role, .sidebar-link span:not(.sidebar-icon),
  .sidebar-footer { display: none; }
  .sidebar-link { justify-content: center; padding: 12px; }
  .sidebar-icon { font-size: 20px; }
  .admin-main { margin-left: 60px; }
  .admin-content { padding: 16px; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .section-toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-search { width: 100%; }
}
