/* ===== 3M 红 · 科技感 · 光影 主题 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* 3M Brand Colors */
  --red: #EE1C25;
  --red-dark: #B8131A;
  --red-glow: rgba(238, 28, 37, 0.4);
  --red-subtle: rgba(238, 28, 37, 0.12);

  /* Dark tech palette */
  --bg-primary: #0C0C14;
  --bg-secondary: #12121E;
  --bg-card: #1A1A2E;
  --bg-card-hover: #222240;
  --bg-surface: rgba(26, 26, 46, 0.8);

  /* Text */
  --text-primary: #F0F0F5;
  --text-secondary: #9090B0;
  --text-muted: #606080;

  /* Borders & accents */
  --border: rgba(238, 28, 37, 0.2);
  --border-glow: rgba(238, 28, 37, 0.5);

  /* Status */
  --success: #00D68F;
  --success-bg: rgba(0, 214, 143, 0.1);
  --warning: #FFAA00;
  --warning-bg: rgba(255, 170, 0, 0.1);
  --danger: #EE1C25;
  --danger-bg: rgba(238, 28, 37, 0.1);
  --info: #5C7CFF;
  --info-bg: rgba(92, 124, 255, 0.1);

  /* Effects */
  --shadow-glow: 0 0 20px rgba(238, 28, 37, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --radius: 10px;
  --radius-sm: 6px;

  /* Font */
  --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC', sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', monospace;
}

html { background: var(--bg-primary); }
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(238, 28, 37, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(238, 28, 37, 0.05) 0%, transparent 50%);
}

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red); text-shadow: 0 0 8px var(--red-glow); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--red-subtle); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--red-glow); }

/* ===== Login ===== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(238, 28, 37, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 70%, rgba(238, 28, 37, 0.04) 0%, transparent 40%);
  animation: bgPulse 8s ease-in-out infinite alternate;
}
@keyframes bgPulse {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1.1) rotate(3deg); }
}

.login-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 420px;
  max-width: 90vw;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  backdrop-filter: blur(20px);
}
.login-card::after {
  content: '';
  position: absolute;
  top: -1px; left: 20%; right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  border-radius: 50%;
}
.login-card h1 {
  font-size: 20px; text-align: center; margin-bottom: 4px;
  background: linear-gradient(135deg, #fff 30%, var(--red) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-card .subtitle {
  text-align: center; color: var(--text-secondary); font-size: 13px; margin-bottom: 28px;
}
.login-card .subtitle strong { color: var(--red); }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase;
  letter-spacing: 1px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-primary);
  transition: all 0.2s; outline: none; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 12px var(--red-glow), inset 0 0 12px rgba(238, 28, 37, 0.05);
  background: rgba(255,255,255,0.08);
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group textarea { resize: vertical; min-height: 80px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; transition: all 0.2s;
  letter-spacing: 0.5px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  box-shadow: 0 4px 16px rgba(238, 28, 37, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(238, 28, 37, 0.4);
}
.btn-success {
  background: linear-gradient(135deg, #00D68F, #00A86B);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 214, 143, 0.3);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0, 214, 143, 0.4); }
.btn-warning {
  background: linear-gradient(135deg, #FFAA00, #E69500);
  color: #fff;
}
.btn-danger {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
}
.btn-outline {
  background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--red); color: var(--red); background: var(--red-subtle); }
.btn-export {
  background: transparent; border: 1px solid var(--red); color: var(--red); font-size: 12px; padding: 6px 14px; border-radius: 6px; cursor: pointer; transition: all .2s;
}
.btn-export:hover { background: var(--red); color: #fff; box-shadow: 0 0 12px rgba(238,28,37,0.3); }
.btn-sm { padding: 6px 14px; font-size: 12px; }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px; background: var(--bg-secondary);
  padding: 0; flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(238,28,37,0.06) 0%, transparent 100%);
}
.sidebar-header h2 { font-size: 15px; font-weight: 700; background: linear-gradient(135deg, #fff 30%, var(--red) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.sidebar-header .role-badge { display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 10px; margin-top: 4px; letter-spacing: 1px; text-transform: uppercase; border: 1px solid var(--border); color: var(--red); }

.nav-list { list-style: none; padding: 12px 0; flex: 1; }
.nav-list li {
  padding: 12px 20px; cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); display: flex; align-items: center; gap: 10px;
  transition: all 0.2s; position: relative;
}
.nav-list li:hover { color: var(--text-primary); background: var(--red-subtle); }
.nav-list li.active {
  color: var(--red); font-weight: 600;
  background: linear-gradient(90deg, var(--red-subtle), transparent);
}
.nav-list li.active::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 3px; background: var(--red); border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--red-glow);
}
.nav-list li .badge {
  margin-left: auto;
  background: var(--red);
  color: #fff; font-size: 10px; padding: 1px 8px; border-radius: 10px;
  box-shadow: 0 0 8px var(--red-glow);
}
.nav-list li.logout { margin-top: auto; border-top: 1px solid var(--border); color: var(--text-muted); }
.nav-list li.logout:hover { color: var(--danger); background: var(--danger-bg); }

/* Main Content */
.main-content {
  flex: 1; padding: 28px 36px; overflow-y: auto;
  background: var(--bg-primary);
}
.page-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;
}
.page-header h1 { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.page-header .actions { display: flex; gap: 10px; }

/* ===== Stats Cards ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
}
.stat-card .label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-card .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== Tables ===== */
.table-container {
  background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-card);
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 14px 18px; font-size: 11px; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; letter-spacing: 1px;
  border-bottom: 1px solid var(--border); background: rgba(238,28,37,0.03);
}
td { padding: 14px 18px; font-size: 13px; border-bottom: 1px solid rgba(238, 28, 37, 0.08); color: var(--text-secondary); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--red-subtle); }

/* Status badges */
.status { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.status-active, .status-approved { background: var(--success-bg); color: var(--success); border: 1px solid rgba(0,214,143,0.2); }
.status-pending { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255,170,0,0.2); }
.status-rejected { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(238,28,37,0.2); }
.status-new { background: var(--info-bg); color: var(--info); border: 1px solid rgba(92,124,255,0.2); }
.status-contacted { background: rgba(92,124,255,0.08); color: #8BA4FF; border: 1px solid rgba(92,124,255,0.15); }
.status-closed { background: rgba(144,144,176,0.08); color: var(--text-muted); border: 1px solid rgba(144,144,176,0.15); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: var(--bg-card); border-radius: 14px; padding: 32px;
  width: 580px; max-width: 90vw; max-height: 85vh; overflow-y: auto;
  border: 1px solid var(--border); box-shadow: var(--shadow-card), 0 0 40px rgba(238,28,37,0.1);
}
.modal h2 { font-size: 17px; margin-bottom: 20px; color: var(--text-primary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 20px; right: 20px; padding: 14px 24px;
  border-radius: var(--radius-sm); color: #fff; font-size: 13px;
  z-index: 2000; animation: slideIn 0.3s ease-out;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4); backdrop-filter: blur(12px);
}
.toast-success { background: linear-gradient(135deg, #00D68F, #00A86B); }
.toast-error { background: linear-gradient(135deg, var(--red), var(--red-dark)); }
.toast-info { background: linear-gradient(135deg, #1a1a3e, #2a2a5e); border: 1px solid var(--border); }
@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Filters ===== */
.filters { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filters select, .filters input {
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-primary); outline: none;
}
.filters select:focus, .filters input:focus {
  border-color: var(--red); box-shadow: 0 0 8px var(--red-glow);
}

/* ===== Detail ===== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.detail-item label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-item .val { font-size: 14px; color: var(--text-primary); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

/* ===== Misc ===== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== Responsive ===== */

/* Mobile menu toggle button */
.menu-toggle {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 1001;
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 20px;
  cursor: pointer; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
}
.menu-toggle:active { background: var(--bg-card-hover); }

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  
  /* Sidebar becomes a slide-over panel */
  .sidebar {
    position: fixed; top: 0; left: -260px; bottom: 0;
    width: 240px; z-index: 1000;
    transition: left 0.3s ease; box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 999;
    display: none;
  }
  .sidebar-overlay.open { display: block; }
  
  .main-content {
    padding: 60px 12px 20px;
  }
  
  /* Page header */
  .page-header {
    flex-direction: column; align-items: flex-start; gap: 10px;
  }
  .page-header h1 { font-size: 17px; }
  .page-header .actions {
    width: 100%; flex-wrap: wrap;
  }
  .page-header .actions .btn { flex: 1; min-width: 0; justify-content: center; font-size: 12px; }
  .page-header .actions .btn-sm { flex: none; }
  
  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 16px; }
  .stat-card .value { font-size: 22px; }
  
  /* Tables - horizontal scroll */
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-container table { min-width: 600px; }
  th, td { padding: 10px 12px; font-size: 12px; white-space: nowrap; }
  
  /* Forms */
  .form-row { grid-template-columns: 1fr; gap: 10px; }
  .form-group { margin-bottom: 12px; }
  .form-group input, .form-group select, .form-group textarea {
    padding: 14px 12px; font-size: 16px; /* Larger touch target */
  }
  
  /* Modal */
  .modal {
    width: 96vw; max-width: 96vw;
    padding: 20px 16px;
    margin: 10px;
    max-height: 90vh;
  }
  .modal h2 { font-size: 15px; margin-bottom: 14px; }
  .modal-actions { flex-direction: column; gap: 6px; }
  .modal-actions .btn { width: 100%; justify-content: center; padding: 14px; }
  
  /* Filters */
  .filters { flex-direction: column; gap: 8px; }
  .filters select, .filters input { width: 100%; padding: 12px; font-size: 15px; }
  
  /* Detail grid */
  .detail-grid { grid-template-columns: 1fr; gap: 10px; }
  
  /* Nav list items */
  .nav-list li { padding: 14px 16px; font-size: 14px; }
  .sidebar-header { padding: 16px; }
  .sidebar-header h2 { font-size: 14px; }
  
  /* Login page */
  .login-card { padding: 28px 20px; width: 95vw; }
  .login-card h1 { font-size: 17px; }
  
  /* Buttons */
  .btn { padding: 12px 16px; font-size: 14px; }
  .btn-sm { padding: 10px 14px; }
  
  /* Toast */
  .toast { top: auto; bottom: 16px; left: 16px; right: 16px; text-align: center; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 15px; }
  .modal { padding: 16px 12px; }
}
