/* TaiGo 登录页补充样式 */

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-overlay.hidden {
    display: none;
}

.login-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #0a0a0f 100%);
}

.login-card {
    position: relative;
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 40px;
    width: 360px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ===== Light 主题登录页覆盖 ===== */
[data-theme="light"] .login-bg {
    background: linear-gradient(135deg, #e0e7ff 0%, #f5f3ff 50%, #ede9fe 100%);
}
[data-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e5e7eb;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .login-subtitle {
    color: var(--text3);
}
[data-theme="light"] .login-tab {
    background: #f5f7fa;
    border: 1px solid #e5e7eb;
    color: var(--text2);
}
[data-theme="light"] .login-tab.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-color: transparent;
}
[data-theme="light"] .login-form input,
[data-theme="light"] .login-form select {
    background: #f5f7fa;
    border: 1px solid #d1d5db;
    color: var(--text1);
}
[data-theme="light"] .login-form input:focus,
[data-theme="light"] .login-form select:focus {
    border-color: #6366f1;
    background: #fff;
}
[data-theme="light"] .login-form input::placeholder {
    color: var(--text3);
}
[data-theme="light"] .login-error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
[data-theme="light"] .login-hint-text {
    color: var(--text3) !important;
}

.login-logo {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    text-align: center;
    color: var(--text3, #888);
    font-size: 13px;
    margin-bottom: 32px;
}

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.login-tab {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text2, #aaa);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.login-tab.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-color: transparent;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form.hidden {
    display: none;
}

.login-form input,
.login-form select {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text1, #fff);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.login-form input:focus,
.login-form select:focus {
    border-color: #6366f1;
}

.login-form input::placeholder {
    color: var(--text3, #666);
}

.login-btn {
    padding: 14px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.login-error {
    margin-top: 16px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 13px;
    text-align: center;
}

.login-error.hidden {
    display: none;
}

.user-info-wrapper {
    position: relative;
    cursor: pointer;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(20, 20, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 160px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.user-info-wrapper:hover .user-dropdown,
.user-dropdown.show {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    padding: 10px 16px;
    color: var(--text2, #aaa);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text1, #fff);
}

.user-dropdown-item.logout {
    color: #ef4444;
}

.user-dropdown-item.logout:hover {
  background: rgba(239, 68, 68, 0.1);
}

.opc-tai-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.opc-tai-label {
  font-size: 13px;
  color: #94a3b8;
}

.opc-tai-value {
  font-size: 18px;
  font-weight: 700;
  color: #6366f1;
}

@media (max-width: 768px) {
  .growth-radar-section {
    display: block !important;
    margin-top: 16px;
    text-align: center;
  }
  
  #radarChart {
    max-width: 260px;
    height: auto;
  }
}

/* TAIGO 聊天窗口流式输出样式 */
.msg-bubble.streaming .msg-text::after {
    content: '▊';
    animation: blink 0.8s infinite;
    color: var(--accent, #6366f1);
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.msg-bubble:not(.streaming) .msg-text::after {
    content: none;
}

/* ============ ADMIN BACKEND STYLES ============ */
.admin-layout {
  display: flex;
  height: calc(100vh - 56px);
  background: var(--bg);
}

.admin-sidebar {
  width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
  overflow-y: auto;
  height: calc(100vh - 56px);
}

.admin-sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.admin-sidebar-icon { font-size: 22px; }

.admin-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px;
}

.admin-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--text2);
  font-size: 14px;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.admin-menu-item:hover { background: rgba(99,102,241,0.08); color: var(--text); }
.admin-menu-item.active { background: rgba(99,102,241,0.15); color: var(--accent); font-weight: 600; }

/* Admin menu group (e.g. 商城管理) */
.admin-menu-group { margin: 4px 0; }
.admin-menu-group-title {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
}
.admin-menu-sub { padding-left: 32px; font-size: 13px; }

.admin-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* Admin form styles (used in shop product modal etc.) */
.admin-form-group { margin-bottom: 14px; }
.admin-form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 4px; }
.admin-form-row { display: flex; gap: 12px; }
.admin-textarea { width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border, rgba(255,255,255,0.12)); background: var(--card, rgba(255,255,255,0.04)); color: var(--text); font-size: 14px; resize: vertical; min-height: 60px; }
.admin-textarea:focus { outline: none; border-color: var(--accent); }

@keyframes scanLine {
  0% { top: -2px; }
  50% { top: calc(100% - 22px); }
  100% { top: -2px; }
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.admin-panel-header h2 { font-size: 20px; font-weight: 700; color: var(--text); }

.admin-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-log-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.admin-log-tab {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg3);
  border: none;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
}

.admin-log-tab + .admin-log-tab {
  border-left: 1px solid var(--border);
}

.admin-log-tab.active {
  background: var(--accent);
  color: #fff;
}

.admin-log-tab:hover:not(.active) {
  background: rgba(99,102,241,0.1);
}

.admin-select {
  padding: 8px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.admin-select:focus { border-color: var(--accent); }
.admin-select option { background: var(--bg2); color: var(--text); }

.admin-btn {
  padding: 8px 16px;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.admin-btn:hover { background: rgba(99,102,241,0.25); }
.admin-btn.btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-color: transparent;
}
.admin-btn.btn-primary:hover { box-shadow: 0 4px 16px rgba(99,102,241,0.4); transform: translateY(-1px); }
.admin-btn.btn-secondary { background: var(--bg3); color: var(--text2); border-color: var(--border); }
.admin-btn.btn-secondary:hover { background: var(--bg4); color: var(--text); }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.admin-stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
}
.admin-stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.admin-stat-label { font-size: 12px; color: var(--text3); margin-top: 4px; }
.admin-stat-card.stat-temp { border-color: rgba(245,158,11,0.3); }
.admin-stat-card.stat-temp .admin-stat-value { color: #f59e0b; }
.admin-stat-card.stat-boss { border-color: rgba(99,102,241,0.3); }
.admin-stat-card.stat-boss .admin-stat-value { color: #6366f1; }
.admin-stat-card.stat-opc { border-color: rgba(34,197,94,0.3); }
.admin-stat-card.stat-opc .admin-stat-value { color: #22c55e; }

.admin-table-wrapper {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table thead { background: var(--bg3); }
.admin-table th {
  padding: 12px 16px;
  text-align: left;
  color: var(--text2);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(45,58,79,0.5);
  color: var(--text);
}
.admin-table tbody tr:hover { background: rgba(99,102,241,0.04); }
.admin-table tbody tr:last-child td { border-bottom: none; }

.admin-empty {
  text-align: center;
  padding: 40px 16px !important;
  color: var(--text3);
  font-size: 14px;
}

/* Role badges in table */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}
.role-badge.role-temp { background: rgba(245,158,11,0.15); color: #f59e0b; }
.role-badge.role-boss { background: rgba(99,102,241,0.15); color: #818cf8; }
.role-badge.role-opc { background: rgba(34,197,94,0.15); color: #22c55e; }
.role-badge.role-operator { background: rgba(6,182,212,0.15); color: #06b6d4; }
.role-badge.role-admin { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Skill tags display in admin user table */
.admin-skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.admin-skill-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(34,197,94,0.12);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.25);
  white-space: nowrap;
}

.admin-action-btn {
  padding: 6px 12px;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.admin-action-btn:hover { background: rgba(99,102,241,0.25); }
.admin-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.admin-action-btn.admin-delete-btn { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.25); color: #ef4444; }
.admin-action-btn.admin-delete-btn:hover { background: rgba(239,68,68,0.25); }

.admin-input {
  width: 100%;
  padding: 8px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border 0.2s;
}
.admin-input:focus { border-color: var(--accent); }

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.admin-page-btn {
  padding: 6px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.admin-page-btn:hover { border-color: var(--accent); color: var(--accent); }
.admin-page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.admin-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.admin-page-info { color: var(--text3); font-size: 12px; }

/* Role Change Modal */
.admin-modal { position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center; }
.admin-modal.hidden { display: none; }
.admin-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.admin-modal-content {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 460px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.admin-modal-header h3 { font-size: 16px; font-weight: 600; }
.admin-modal-close {
  width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 16px; transition: all 0.2s;
}
.admin-modal-close:hover { background: var(--bg3); color: var(--text); }

.admin-modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; min-height: 0; }

.admin-modal-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg3);
  border-radius: 10px;
  margin-bottom: 12px;
}
.admin-modal-user-avatar {
  width: 40px; height: 40px; border-radius: 10px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 16px;
}
.admin-modal-user-img {
  width: 48px; height: 48px; border-radius: 12px; object-fit: cover; border: 2px solid rgba(99,102,241,0.25);
}
.profile-modal-avatar {
  position: relative;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
}
.profile-modal-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.avatar-upload-trigger:hover {
  background: #6366f1 !important;
  color: #fff !important;
  border-color: #6366f1 !important;
}
.avatar-upload-trigger.uploading,
.profile-modal-avatar.uploading {
  animation: avatarPulse 1s ease infinite;
}
@keyframes avatarPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.admin-modal-user-details { flex: 1; }
.admin-modal-user-name { font-weight: 600; font-size: 14px; }
.admin-modal-user-id { font-size: 11px; color: var(--text3); font-family: monospace; }

.admin-modal-field { margin-bottom: 12px; }
.admin-modal-field label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 500; }
.admin-modal-current-role {
  padding: 8px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.admin-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  resize: vertical;
  font-family: inherit;
}
.admin-textarea:focus { border-color: var(--accent); }

.admin-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ID column - truncated */
.admin-table .cell-id {
  font-family: monospace;
  font-size: 11px;
  color: var(--text3);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Role transition arrow in log */
.role-arrow { color: var(--text3); margin: 0 6px; }

/* ========== Task Pub View Modal Styles (Read-only Detail View) ========== */
.admin-view-section { display: flex; flex-direction: column; gap: 8px; }
.admin-view-field { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed rgba(128,128,128,0.1); }
.admin-view-field:last-child { border-bottom: none; }
.admin-view-label {
  min-width: 80px; font-size: 12px; color: var(--text3); font-weight: 500;
  flex-shrink: 0;
}
.admin-view-value {
  font-size: 13px; color: var(--text1); font-weight: 500; word-break: break-all;
}
.admin-view-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.admin-view-desc { font-size: 13px !important; }

/* ========== New Admin Pages: Activities / Tasks Publish / Menu ========== */
.admin-modal-row { display:flex; gap:12px; }
.activity-status-draft { background:rgba(245,158,11,0.15); color:#f59e0b; }
.activity-status-published { background:rgba(99,102,241,0.15); color:#6366f1; }
.activity-status-ongoing { background:rgba(34,197,94,0.15); color:#22c55e; }
.activity-status-ended { background:rgba(148,163,184,0.15); color:#94a3b8; }

/* Verify panel layout */
.admin-verify-scanner-area {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 20px;
}
.admin-verify-camera-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.admin-verify-order-col {
  flex: 1;
  min-width: 280px;
  max-width: 420px;
}

/* Health tabs navigation */
.admin-health-tabs-nav {
  display: flex;
  gap: 4px;
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Verify history section */
.admin-verify-history {
  padding: 0 20px 20px;
}

/* Health section padded */
.health-section-padded {
  padding: 0 20px 20px;
}

/* Health alerts section */
.health-alerts-section {
  margin: 0 20px 16px;
}

/* ========== Mobile hamburger button ========== */
.admin-mobile-menu-btn {
  display: none;
  position: fixed;
  top: 58px;
  left: 10px;
  z-index: 9999;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.admin-mobile-menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s;
}

/* Sidebar overlay (mobile) */
.admin-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1050;
  backdrop-filter: blur(2px);
}
.admin-sidebar-overlay.active {
  display: block;
}

/* Sidebar close button (mobile) */
.admin-sidebar-close {
  display: none;
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--bg3);
  color: var(--text3);
  font-size: 14px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

@media (max-width: 1024px) {
  .admin-sidebar {
    width: 180px;
    padding: 16px 0;
  }
  .admin-sidebar-header { padding: 0 14px 14px; font-size: 14px; }
  .admin-menu-item { padding: 10px 12px; font-size: 13px; }
  .admin-main { padding: 20px 24px; }
  .admin-stats { gap: 12px; }
  .admin-stat-card { padding: 12px 14px; }
  .admin-stat-value { font-size: 24px; }
  .admin-panel-header h2 { font-size: 18px; }
}

@media (max-width: 768px) {
  /* Show hamburger button */
  .admin-mobile-menu-btn { display: flex; }

  /* Fix: allow admin view to show fixed/absolute children */
  #view-admin.view.active { overflow: visible !important; }

  /* Sidebar becomes slide-in overlay */
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    overflow-y: auto;
  }
  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }
  .admin-sidebar-close { display: flex; }

  /* Main area takes full width */
  .admin-main {
    padding: 56px 12px 16px;
    width: 100%;
  }

  /* Layout no longer uses flex side-by-side */
  .admin-layout {
    display: block;
    height: auto;
    min-height: calc(100vh - 56px);
  }

  /* Stats: 2 columns on mobile */
  .admin-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .admin-stat-card { padding: 10px 12px; }
  .admin-stat-value { font-size: 22px; }
  .admin-stat-label { font-size: 11px; }

  /* Panel header: stack vertically */
  .admin-panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .admin-panel-header h2 { font-size: 17px; }

  /* Filter bar: wrap */
  .admin-filter-bar {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }
  .admin-filter-bar .admin-select { flex: 1; min-width: 0; }
  .admin-filter-bar .admin-btn { flex-shrink: 0; }

  /* Log tabs: smaller */
  .admin-log-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-log-tab { padding: 6px 10px; font-size: 12px; white-space: nowrap; }

  /* Table: horizontal scroll */
  .admin-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table { font-size: 12px; min-width: 600px; }
  .admin-table th, .admin-table td { padding: 8px 10px; }
  .admin-table th { font-size: 11px; }

  /* Pagination: compact */
  .admin-pagination { gap: 4px; margin-top: 14px; }
  .admin-page-btn { padding: 4px 10px; font-size: 12px; }

  /* Buttons: slightly larger touch targets */
  .admin-btn { padding: 8px 14px; font-size: 13px; }
  .admin-action-btn { padding: 6px 10px; font-size: 11px; }

  /* Modal: full-width on mobile */
  .admin-modal-content {
    width: 100%;
    max-width: 100vw;
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    overflow-y: visible;
  }
  .admin-modal {
    align-items: flex-end;
  }
  .admin-modal-header { padding: 16px 18px; }
  .admin-modal-body { padding: 16px 18px; }
  .admin-modal-footer { padding: 12px 18px; }

  /* Modal rows: stack on mobile */
  .admin-modal-row { flex-direction: column; gap: 0; }
  .admin-view-row2 { grid-template-columns: 1fr; }

  /* Verify panel: stack layout */
  .admin-verify-scanner-area {
    flex-direction: column;
    padding: 12px;
    gap: 12px;
  }
  .admin-verify-order-col {
    min-width: 0;
    max-width: 100%;
  }

  /* Health dashboard: adjust padding */
  .health-metrics-grid { grid-template-columns: 1fr; gap: 10px; }
  .health-metric-card { padding: 12px 14px; }
  .health-metric-value { font-size: 22px; }

  /* Health tab navigation: scrollable */
  .admin-health-tabs-nav { padding: 0 12px 10px; gap: 4px; }
  .health-section-padded { padding: 0 12px 16px; }
  .health-alerts-section { margin: 0 12px 12px; }

  /* Verify scanner: smaller on mobile */
  #verifyScannerBox { height: 220px !important; max-width: 100% !important; }

  /* Verify history padding on mobile */
  .admin-verify-history { padding: 0 12px 12px; }
}

@media (max-width: 480px) {
  .admin-main { padding: 52px 8px 12px; }
  .admin-stats { gap: 6px; }
  .admin-stat-card { padding: 8px 10px; }
  .admin-stat-value { font-size: 18px; }
  .admin-stat-label { font-size: 10px; }
  .admin-panel-header h2 { font-size: 15px; }
  .admin-table { font-size: 11px; min-width: 500px; }
  .admin-btn { padding: 7px 10px; font-size: 12px; }
  .admin-select { padding: 7px 10px; font-size: 12px; }
  .admin-log-tab { padding: 5px 8px; font-size: 11px; }
  .health-metric-value { font-size: 18px; }
}

/* ========== Health Dashboard Styles ========== */
.health-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.health-metric-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 16px 18px;
}

.health-metric-label {
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
  margin-bottom: 8px;
}

.health-metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.health-metric-target {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 10px;
}

.health-metric-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}

.health-metric-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease, background 0.3s ease;
}

.health-metric-card.warn {
  border-left-color: #f59e0b;
}

.health-metric-card.warn .health-metric-fill {
  background: #f59e0b !important;
}

.health-metric-card.danger {
  border-left-color: #ef4444;
}

.health-metric-card.danger .health-metric-fill {
  background: #ef4444 !important;
}

.health-tab.active {
  background: rgba(99,102,241,0.2);
  border-color: var(--accent);
  color: var(--accent);
}

.health-alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 10px;
  margin-bottom: 8px;
}

.health-alert-item .alert-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.health-alert-item .alert-body {
  flex: 1;
}

.health-alert-item .alert-msg {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.health-alert-item .alert-advice {
  font-size: 11px;
  color: var(--text3);
}
