
/* ===== Layout ===== */
.layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-height: 100vh;
  overflow: hidden;
}

/* ===== Sidebar — Glassmorphism (matching vehicle-doc-app style) ===== */
.sidebar {
  width: 220px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-right: none;
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: var(--z-sidebar);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.10);
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 22px 20px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sidebar-logo h2 {
  font-size: 17px;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.2px;
}

.sidebar-menu {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
}

.sidebar-links {
  padding: 8px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sidebar-link-item {
  display: flex;
  align-items: center;
  padding: 10px 24px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  font-size: 13px;
}

.sidebar-link-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-primary);
}

.sidebar-link-item .icon {
  margin-right: 10px;
  width: 16px;
  text-align: center;
}

.menu-item {
  display: flex;
  align-items: center;
  /* Matching vehicle-doc-app nav button style */
  min-height: auto;
  padding: 11px 14px 11px 14px;
  line-height: 1.4;
  color: var(--text-sidebar);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  border-left: none;
  border-radius: 14px;
  box-sizing: border-box;
  margin-bottom: 2px;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-primary);
}

.menu-item.active {
  background: #FFFFFF;
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.16);
  border-left: none;
}

.menu-item .icon {
  margin-right: 10px;
  width: 18px;     /* Round3 Fix T1: 统一 icon 宽度 18px（不再 16px），消除顶级/父目录首字差 2px 根因 */
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-style: normal;
  color: inherit;
}

/* ===== Collapsible Menu Groups ===== */
.menu-group {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

/* Note: .menu-group-header is defined below (around line 700) */

.menu-group-items {
  max-height: 600px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  opacity: 1;
}

.menu-group.collapsed .menu-group-items {
  max-height: 0 !important;
  opacity: 0;
  overflow: hidden;
}

/* ===== 侧边栏菜单项：顶级项 / 父目录 / 子目录 文字严格垂直居中 =====
   Round4 Fix T1: 统一使用 min-height:38px + padding:0 + line-height:38px
   三级对齐基线（文字左起点）：顶级项=父目录=子目录 = 52px
   计算：padding-left 24px + icon宽度 18px + icon与文字间距 10px = 52px
   子目录（无图标）padding-left 直接=52px ===== */
.sidebar-menu > .menu-item {
  justify-content: flex-start;
  text-align: left;
  padding: 0 20px 0 24px;
  line-height: 38px;
  min-height: 38px;
  font-size: 14px;
  font-weight: 600;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-menu > .menu-item .icon {
  margin-right: 10px;
  width: 18px;
  height: 38px;
  line-height: 38px;
  text-align: center;
  flex-shrink: 0;
  font-size: 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.sidebar-menu > .menu-item.active {
  justify-content: flex-start;
}

/* ===== 父目录（菜单组标题）：与顶级项/子目录文字基线严格对齐 =====
   Round4 Fix T1: 整合到单一 definition，确保 align-items:center + 统一基线
   父目录文字左起点 = 子目录文字左起点 = 52px (24px padding + 18px icon + 10px gap)
*/
.menu-group-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: 0 40px 0 24px; /* right padding 40px gives room for arrow */
  line-height: 38px;
  min-height: 38px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  margin: 2px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-group-header:hover {
  background: rgba(255, 255, 255, 0.7);
}

/* 父目录图标：固定 18px 宽度 + 10px 右间距，使文字起点 = 52px */
.menu-group-header .icon {
  margin-right: 10px;
  width: 18px;
  height: 38px;
  line-height: 38px;
  text-align: center;
  flex-shrink: 0;
  font-size: 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

/* 父目录箭头：改为 flex 布局内元素，不与徽章冲突 Round4 Fix T3 */
.menu-group-header .menu-arrow {
  position: static;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 0;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.25s ease;
  display: inline-block;
}

.menu-group.collapsed .menu-arrow {
  transform: rotate(-90deg);
}

/* 父目录徽章：红色数字显示子目录之和 */
.menu-group-header .menu-badge {
  margin-left: 8px;
  position: relative;
  top: 0;
  vertical-align: middle;
}

.menu-group-header .lock-indicator {
  display: inline-block;
  margin-left: 6px;
  color: #ffb020;
  line-height: 1;
}

/* ===== 子目录：匹配 vehicle-doc-app nav 风格 ===== */
.menu-group-items .menu-item {
  padding: 11px 14px 11px 44px;
  line-height: 1.4;
  min-height: auto;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: all 0.2s;
  border-left: none;
  background: transparent;
  box-sizing: border-box;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.menu-group-items .menu-item > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-group-items .menu-item .menu-badge {
  flex-shrink: 0;
}
.menu-group-items .menu-item:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-primary);
}
.menu-group-items .menu-item.active {
  background: #FFFFFF;
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.16);
  border-left: none;
}
/* 移除子目录前的小圆点 / 竖线干扰 */
.menu-group-items .menu-item::before,
.menu-group-items .menu-item::after {
  display: none !important;
  content: none !important;
}

/* Sub-group (nested) support */
.menu-sub-group {
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.menu-sub-group-header {
  display: flex;
  align-items: center;
  padding: 8px 20px 8px 56px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  user-select: none;
  transition: var(--transition-fast);
}

.menu-sub-group-header:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.04);
}

.menu-sub-group-header .menu-arrow {
  margin-left: auto;
  font-size: 8px;
  transition: transform 0.2s ease;
}

.menu-sub-group.collapsed .menu-arrow {
  transform: rotate(-90deg);
}

.menu-sub-group-items {
  max-height: 300px;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.menu-sub-group.collapsed .menu-sub-group-items {
  max-height: 0 !important;
  overflow: hidden;
}

.menu-sub-group-items .menu-item {
  padding: 7px 20px 7px 72px;
  font-size: 12px;
}

/* ===== 公文预览样式（与导出格式一致） ===== */
.doc-preview {
  font-family: "FangSong_GB2312", "仿宋_GB2312", "仿宋", "STFangsong", "SimSun", "宋体", serif;
  font-size: 16px;
  line-height: 28px;
  color: #000;
  padding: 40px 48px;
  background: #fff;
  max-width: 780px;
  margin: 0 auto;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  min-height: 500px;
}

.doc-preview .doc-title {
  font-family: "方正小标宋简体", "FZXiaoBiaoSong-B05", "STZhongsong", "SimSun", serif;
  font-size: 22px;
  text-align: center;
  font-weight: normal;
  margin-bottom: 32px;
  letter-spacing: 2px;
}

.doc-preview .doc-h1 {
  font-family: "SimHei", "黑体", sans-serif;
  font-size: 16px;
  font-weight: normal;
  margin-top: 16px;
  margin-bottom: 4px;
}

.doc-preview .doc-h2 {
  font-family: "KaiTi_GB2312", "楷体_GB2312", "KaiTi", "楷体", "STKaiti", serif;
  font-size: 16px;
  font-weight: bold;
  margin-top: 8px;
  margin-bottom: 2px;
}

.doc-preview .doc-h3 {
  font-family: "FangSong_GB2312", "仿宋_GB2312", "仿宋", "STFangsong", serif;
  font-size: 16px;
  font-weight: bold;
  margin-top: 4px;
}

.doc-preview .doc-body {
  text-indent: 2em;
  text-align: justify;
  font-family: "FangSong_GB2312", "仿宋_GB2312", "仿宋", "STFangsong", "SimSun", serif;
  font-size: 16px;
  margin: 0;
}

.doc-preview .doc-org {
  text-align: right;
  font-family: "FangSong_GB2312", "仿宋_GB2312", "仿宋", "STFangsong", serif;
  font-size: 16px;
  margin-top: 32px;
  padding-right: 60px;
}

.doc-preview .doc-date {
  text-align: right;
  font-family: "FangSong_GB2312", "仿宋_GB2312", "仿宋", "STFangsong", serif;
  font-size: 16px;
  padding-right: 60px;
}

/* 公文预览/编辑切换按钮 */
.doc-view-toggle {
  display: inline-flex;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}
.doc-view-toggle button {
  padding: 6px 14px;
  font-size: 13px;
  border: none;
  background: #fff;
  cursor: pointer;
  color: #666;
  transition: all 0.15s;
}
.doc-view-toggle button.active {
  background: #1890ff;
  color: #fff;
}
.doc-view-toggle button:hover:not(.active) {
  background: #f5f5f5;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
}

/* ===== Main Content ===== */
.main {
  flex: 1;
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-height: 100vh;
  overflow: hidden;
  background: transparent;
}

/* ===== Header — Glassmorphism (matching vehicle-doc-app style) ===== */
.header {
  height: 64px;
  background: var(--bg-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 18px rgba(31, 38, 135, 0.06);
}

.header-left {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  color: var(--slate-600);
  transition: var(--transition-fast);
}

.menu-toggle:hover {
  background: var(--slate-100);
  border-color: var(--brand);
  color: var(--brand);
}

.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
}

.modal-backdrop.show {
  display: block;
}

.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.user-info span {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* 移动端退出按钮 - 桌面端默认隐藏 */
.mobile-logout-btn {
  display: none !important;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.2s;
  align-items: center;
  justify-content: center;
}
.mobile-logout-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ===== Content — Glassmorphism ===== */
.content {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 24px 32px;
  box-sizing: border-box;
  overflow-y: auto;
  /* Subtle glass background matching doc-pro style */
  background:
    radial-gradient(ellipse 50% 40% at 20% 0%, rgba(122, 166, 255, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 90% 100%, rgba(164, 227, 255, 0.08) 0%, transparent 55%);
}

/* Page sections are scrollable containers */
.page-section {
  display: none;
  box-sizing: border-box;
  padding: 0;
  width: 100%;
  flex-shrink: 0;
}

.page-section.active {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  height: auto;
  max-height: none;
  min-height: 100%;
  -webkit-overflow-scrolling: touch;
  animation: fadeInPage 0.15s ease;
}

/* 加油登记 · 明细导出页面（Tab切换布局） */
.page-section#page-fuel-center.active {
  display: block;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

/* ===== Cards — Glassmorphism (matching vehicle-doc-app style) ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.10);
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  transition: box-shadow 0.25s;
}

.card:hover {
  box-shadow: 0 16px 48px rgba(31, 38, 135, 0.16);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.vehicle-count-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--brand);
  background: var(--brand-light);
  border-radius: var(--radius-full);
  vertical-align: middle;
}

.btn-copy-plate {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  margin-left: 4px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  color: var(--slate-500);
  transition: var(--transition-fast);
  vertical-align: middle;
}

.btn-copy-plate:hover {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
}