:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #0f766e;
  --secondary-hover: #115e59;
  --accent-color: #f59e0b;
  --success-color: #16a34a;
  --danger-color: #dc2626;
  --warning-color: #d97706;
  --info-color: #0891b2;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #ffffff;

  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #eef4ff;
  --bg-hover: #f1f5f9;
  --bg-soft: #f5f9ff;

  --border-color: #d7e1ee;
  --border-light: #e9eff6;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 40px rgba(37, 99, 235, 0.14);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;

  --font-family-base: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family-base);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: linear-gradient(180deg, #eef4fb 0%, #f7fbff 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: all var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

img {
  max-width: 100%;
  border: 0;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-family-base);
  font-size: 14px;
  color: var(--text-primary);
}

input,
textarea,
select,
button {
  font-family: var(--font-family-base);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #c8d6e6;
  border-radius: 20px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9bb2ca;
}

::-webkit-scrollbar-track {
  background: #f3f6fb;
}

/* ========== 通用布局 ========== */
.d-flex {
  display: flex;
}

.align-items-center {
  align-items: center;
}

.justify-content-between {
  justify-content: space-between;
}

.text-center {
  text-align: center;
}

.hidden {
  display: none !important;
}

.w-100 {
  width: 100%;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mt-4 {
  margin-top: 16px;
}

.card,
.search-container,
.form-card,
.table-container,
.content-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  font-weight: 700;
}

.card-body {
  padding: 20px;
}

/* ========== 旧 ERP 常用头部/侧边 ========== */
.header,
.sidebar-header {
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.sidebar {
  background: rgba(255, 255, 255, 0.95);
  border-right: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
}

/* ========== 表单元素 ========== */
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea,
select,
.form-control,
.form-select {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text-primary);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:hover,
textarea:hover,
select:hover,
.form-control:hover,
.form-select:hover {
  border-color: #b8c9dc;
  background: #fcfdff;
}

input:focus,
textarea:focus,
select:focus,
.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  background: #ffffff;
}

input[readonly],
textarea[readonly] {
  background: #f8fafc;
}

.form-control.is-invalid,
.is-invalid {
  border-color: var(--danger-color) !important;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1) !important;
}

/* ========== 错误提示：默认隐藏 ========== */
.invalid-feedback,
.error-message {
  display: none;
  color: var(--danger-color);
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.5;
}

.is-invalid + .invalid-feedback {
  display: block;
}

.field-group .show-error {
  display: block !important;
}

/* ========== 按钮 ========== */
.btn,
.button,
.Search,
.Reset,
.Submit,
input.Search,
input.Reset,
input.Submit,
input[type="submit"],
input[type="button"],
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.btn:hover,
.button:hover,
.Search:hover,
.Reset:hover,
.Submit:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
button:hover {
  transform: translateY(-1px);
}

.btn-primary,
.Search,
input.Search,
.Submit,
input.Submit,
input[type="submit"] {
  background: linear-gradient(135deg, var(--primary-color), #4a74ef);
  color: #ffffff;
  border-color: var(--primary-color);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
}

.btn-primary:hover,
.Search:hover,
input.Search:hover,
.Submit:hover,
input.Submit:hover,
input[type="submit"]:hover {
  background: linear-gradient(135deg, var(--primary-hover), #3d68e8);
  color: #ffffff;
}

.btn-secondary,
.Reset,
input.Reset,
.button,
input[type="button"],
button[type="button"] {
  background: #ffffff;
  color: var(--text-primary);
  border-color: var(--border-color);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.btn-secondary:hover,
.Reset:hover,
input.Reset:hover,
.button:hover,
input[type="button"]:hover,
button[type="button"]:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ========== 旧 ERP 表格兼容 ========== */
.table1,
.table2 {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.td1,
.td2,
.td3,
.td4,
.td5,
.td6,
.td7,
.td8,
.td9,
.line_top,
td {
  border-color: var(--border-light) !important;
}

.line_top {
  background: transparent;
  padding: 10px 12px;
}

.pagesplit {
  font-family: Webdings, sans-serif;
  font-size: 16px;
  color: var(--primary-color);
}

.data-table,
.list-table,
table[bgcolor="#EEEEEE"],
table[bordercolor="#FFFFFF"] {
  width: 100%;
}

.data-table thead,
.list-table thead {
  background: linear-gradient(180deg, #f8fbff, #edf4ff);
}

.data-table th,
.data-table td,
.list-table th,
.list-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
}

.data-table th,
.list-table th {
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table tbody tr:nth-child(even),
.list-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.data-table tbody tr:hover,
.list-table tbody tr:hover,
tr:hover td {
  background: #f5f9ff;
}

/* ========== 搜索区 ========== */
.search-container,
.search-panel {
  padding: 20px;
  margin: 16px auto;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: end;
}

.search-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
  flex: 1;
}

.search-item label {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ========== 导航/树菜单 ========== */
.transport-tab {
  position: relative;
  font-weight: 600;
}

.transport-tab.active {
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.transport-tab span {
  letter-spacing: 0.2px;
}

.tree-container {
  padding: 10px;
}

/* ========== iframe ========== */
iframe {
  background: #ffffff;
}

#frmright {
  background: #ffffff;
}

/* ========== 登录页 ========== */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.16), transparent 28%),
    linear-gradient(135deg, #eef5ff 0%, #f8fbff 50%, #eef8f7 100%);
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(37, 99, 235, 0.16);
  overflow: hidden;
}

.login-header {
  padding: 28px 32px 20px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: #ffffff;
  text-align: center;
}

.login-logo {
  max-width: 280px;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.14));
}

.login-title {
  margin: 12px 0 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.login-subtitle {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  line-height: 1.7;
}

.login-body {
  padding: 28px 32px 30px;
  background: #ffffff;
}

.field-group {
  margin-bottom: 18px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #7b8aa1;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  width: 18px;
  text-align: center;
}

.input-wrap input {
  width: 100%;
  padding-left: 36px;
}

.captcha-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.captcha-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.captcha-img {
  display: block;
}

.link-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.link-muted:hover {
  color: var(--primary-color);
}

.form-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.6;
}

/* ========== 登录页按钮增强 ========== */
.login-body .btn-primary,
.login-body input[type="submit"] {
  min-height: 42px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ========== 提示浮层兼容 ========== */
.notice-box,
.alert-box {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: #ffffff;
  box-shadow: var(--shadow-md);
}

.notice-success {
  border-left: 4px solid var(--success-color);
}

.notice-error {
  border-left: 4px solid var(--danger-color);
}

.notice-warning {
  border-left: 4px solid var(--warning-color);
}

.notice-info {
  border-left: 4px solid var(--info-color);
}

/* ========== 分页 ========== */
.pagination,
.pagebar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pagination a,
.pagebar a,
.pagination span,
.pagebar span {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-secondary);
}

.pagination a:hover,
.pagebar a:hover {
  background: var(--bg-hover);
  color: var(--primary-color);
}

/* ========== 小屏适配 ========== */
@media (max-width: 992px) {
  .search-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .search-form {
    grid-template-columns: 1fr;
  }

  .login-shell {
    padding: 16px;
  }

  .login-header {
    padding: 24px 18px 16px;
  }

  .login-body {
    padding: 22px 18px 24px;
  }

  .captcha-row {
    flex-direction: column;
    align-items: stretch;
  }

  .captcha-box {
    justify-content: flex-start;
  }

  .sidebar {
    width: 156px !important;
  }
}