:root {
  --primary: #2b94d6;
  --primary-hover: #2583bf;
  --text-main: #333;
  --text-sub: #666;
  --bg-body: #f5f7fb;
  --bg-card: #ffffff;
  --border-card: #d0dbe7;
  --nav-bg: #2b94d6;
  --nav-height: 46px;
  --container-width: 1180px;
  --danger: #dc3545;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  margin: 0;
  padding-top: var(--nav-height);
  line-height: 1.5;
  font-size: 14px;
}

/* 布局容器 */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 15px;
}

.page {
  padding: 20px 0;
  min-height: calc(100vh - var(--nav-height));
}

/* 顶部导航栏 (旧版蓝色风格) */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background-color: var(--nav-bg);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  z-index: 1000;
  color: #fff;
  font-size: 14px;
}

.navbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 15px;
}

.navbar-brand {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  margin-right: 30px;
  display: flex;
  align-items: center;
}

.navbar-nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
  align-items: center;
}

.nav-item {
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
}

.nav-link {
  color: #fff;
  text-decoration: none;
  padding: 0 15px;
  height: 100%;
  display: flex;
  align-items: center;
  transition: background-color 0.2s;
  cursor: pointer;
}

.nav-link:hover, .nav-item.active .nav-link, .nav-link.active {
  background-color: rgba(255, 255, 255, 0.18);
}

/* Dropdown */
.dropdown-menu {
  display: none;
  position: absolute;
  top: var(--nav-height);
  left: 0;
  background-color: #fff;
  min-width: 160px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 4px 4px;
  padding: 5px 0;
  z-index: 1001;
}

.nav-item:hover .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 8px 16px;
  color: #333;
  text-decoration: none;
  transition: background-color 0.1s;
}

.dropdown-item:hover {
  background-color: #f0f7ff;
  color: var(--primary);
}

/* Mobile Toggle */
.navbar-toggler {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  color: #fff;
  font-size: 20px;
  padding: 2px 8px;
  cursor: pointer;
}

/* Responsive Nav */
@media (max-width: 768px) {
  .navbar-toggler {
    display: block;
  }
  .navbar-nav {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background-color: #fff; /* 移动端下拉背景白底 */
    flex-direction: column;
    height: auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-top: 1px solid #eee;
  }
  .navbar-nav.show {
    display: flex;
  }
  .nav-item {
    width: 100%;
    height: auto;
    display: block;
    border-bottom: 1px solid #f0f0f0;
  }
  .nav-link {
    color: #333; /* 移动端文字变深色 */
    padding: 12px 15px;
    height: auto;
  }
  .nav-link:hover, .nav-item.active .nav-link {
    background-color: #f0f7ff;
    color: var(--primary);
  }
  
  .dropdown-menu {
    position: static;
    display: none;
    box-shadow: none;
    border: none;
    background: #f9f9f9;
    padding-left: 20px;
    width: 100%;
  }
  /* 移动端点击展开 dropdown，这里配合 JS 的 .open 类 */
  .nav-item.open .dropdown-menu {
    display: block;
  }
  /* 移动端禁用 hover 自动展示，防止点击跳转冲突 */
  .nav-item:hover .dropdown-menu {
    display: none; 
  }
  .nav-item.open:hover .dropdown-menu {
    display: block;
  }
}

/* 卡片样式 */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* 标题体系 */
h1 { font-size: 24px; margin-bottom: 10px; color: var(--text-main); }
h2 { font-size: 18px; margin-bottom: 12px; border-left: 4px solid var(--primary); padding-left: 10px; line-height: 1.2; color: var(--text-main); }
h3 { font-size: 16px; margin-bottom: 8px; font-weight: 600; }
p.sub { color: var(--text-sub); margin-bottom: 20px; font-size: 14px; }

/* 按钮 */
.btn {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: #fff;
  color: #555;
  border-color: #ccc;
}
.btn-secondary:hover:not(:disabled) {
  background-color: #f0f0f0;
  border-color: #bbb;
  color: #333;
}
.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* 输入控件 */
input[type="text"], input[type="number"], input[type="date"], select {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
  outline: none;
  width: 100%;
}
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(43,148,214,0.1);
}

/* 表单行布局辅助 */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 10px; }
label { display: block; margin-bottom: 5px; color: var(--text-main); font-weight: 500; }

/* 首页特定布局 */
.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.entry-card {
  text-align: center;
  cursor: pointer;
  padding: 30px 20px;
  border: 1px solid var(--border-card);
  transition: all 0.2s;
}
.entry-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: var(--primary);
}
.entry-card h3 {
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 10px;
}
.entry-card p {
  color: var(--text-sub);
  font-size: 13px;
  margin-bottom: 15px;
}

/* 修复：表格点击编辑时宽度突然缩窄的问题 (编辑态不缩窄) */
.sheet-wrap,
.table-wrap,
.grid-wrap,
.table-container,
.data-wrap {
  width: 100% !important;
  min-width: 100% !important;
  box-sizing: border-box;
}

.sheet-wrap table,
.table-wrap table,
.grid-wrap table,
.table-container table,
.data-wrap table {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: fixed !important;
}

/* 强制输入框宽度 */
input, textarea {
  width: 100%;
  box-sizing: border-box;
}

/* Flex/Grid 容器下的防缩处理 */
.input-row > div,
.preview-row > div,
.row2 > div,
.row3 > div,
.flex-item {
  min-width: 0;
}
