/* === ScrapEcom — Excel-style Data Dashboard === */

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

:root {
  --bg: #f8f9fa;
  --card: #ffffff;
  --border: #dadce0;
  --text: #202124;
  --text-secondary: #5f6368;
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --danger: #d93025;
  --green: #0d652d;
  --topbar-bg: #ffffff;
  --topbar-border: #e0e0e0;
  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
}

/* --- 登录页 --- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f0f2f5;
}
.login-container { width: 100%; max-width: 380px; padding: 0 16px; }
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.login-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 28px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 12px;
  font-size: 14px;
  font-family: var(--font);
  transition: border-color .2s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26,115,232,.15);
}
.error-msg {
  color: var(--danger);
  font-size: 12px;
  margin-bottom: 12px;
}
.btn-primary {
  width: 100%;
  height: 40px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

/* --- 顶栏 --- */
.topbar {
  display: flex;
  align-items: center;
  height: 48px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-right: 24px;
}
.topbar-tabs { display: flex; gap: 0; flex: 1; }
.tab-btn {
  background: none;
  border: none;
  padding: 0 16px;
  height: 48px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* --- 工具按钮 --- */
.btn-sm {
  height: 30px;
  padding: 0 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s;
}
.btn-sm:hover { background: #f1f3f4; }

/* --- 筛选工具栏 --- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--topbar-border);
}
.toolbar select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font);
  background: #fff;
}
.row-count {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: auto;
}

/* --- 表格区域 --- */
.grid-container {
  padding: 0;
  height: calc(100vh - 48px - 46px);
}
.grid-panel {
  width: 100%;
  height: 100%;
}

/* ag-Grid 微调 */
.ag-theme-alpine {
  --ag-font-family: var(--font);
  --ag-font-size: 12px;
  --ag-header-height: 34px;
  --ag-row-height: 32px;
  --ag-header-background-color: #f8f9fa;
}
.ag-theme-alpine .ag-header-cell-label { font-weight: 600; }

/* 利润率颜色标记 */
.profit-high { color: var(--green); font-weight: 600; }
.profit-medium { color: #e37400; font-weight: 500; }
.profit-low { color: var(--danger); }
