/* ============================================================
   津成车队填报汇总系统 - 现代化界面 v2.0
   主题：铁路蓝 · 商务 · 移动优先
   ============================================================ */
:root {
  --primary: #1a4d8f;
  --primary-dark: #123a6d;
  --primary-light: #2d6bc4;
  --accent: #2e8b57;
  --accent-light: #e8f5e9;
  --gradient: linear-gradient(135deg, #1a4d8f 0%, #2563eb 60%, #3b82f6 100%);
  --gradient-green: linear-gradient(135deg, #2e8b57 0%, #34a06a 100%);
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e9f0;
  --shadow-sm: 0 1px 3px rgba(16, 42, 84, .08);
  --shadow-md: 0 4px 16px rgba(16, 42, 84, .10);
  --shadow-lg: 0 12px 32px rgba(16, 42, 84, .16);
  --radius: 14px;
  --radius-sm: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ==================== 顶部导航 ==================== */
.topbar {
  background: var(--gradient);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  box-shadow: 0 2px 12px rgba(16, 42, 84, .25);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar .meta { font-size: 13px; opacity: .95; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar a {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(255,255,255,.16);
  transition: background .2s;
  margin-left: 6px;
}
.topbar a:hover { background: rgba(255,255,255,.3); }

/* ==================== 容器 ==================== */
.container { max-width: 900px; margin: 0 auto; padding: 20px 16px 40px; }

/* ==================== 卡片 ==================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow .25s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card h2 {
  font-size: 16px;
  margin-bottom: 14px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.card h3 { font-size: 14.5px; margin: 16px 0 10px; color: #4b5563; font-weight: 600; }

/* ==================== 表单 ==================== */
label { display: block; font-size: 13.5px; margin: 12px 0 5px; color: #4b5563; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;  /* >=16px 防止 iOS Safari 聚焦自动放大 */
  background: #fff;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
}
select { line-height: 1.2; }
textarea { height: auto; min-height: 70px; max-height: none; }
/* 日期控件：全面强制尺寸，防 iOS 原生控件撑大/溢出 */
input[type=date] {
  display: block;
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  padding: 0 8px !important;
  margin: 0;
  line-height: 40px;
  overflow: hidden;
  text-overflow: clip;
}
input[type=date]::-webkit-datetime-edit { font-size: 15px; padding: 0; line-height: 1; }
input[type=date]::-webkit-datetime-edit-fields-wrapper { padding: 0; margin: 0; }
input[type=date]::-webkit-datetime-edit-year-field,
input[type=date]::-webkit-datetime-edit-month-field,
input[type=date]::-webkit-datetime-edit-day-field { padding: 0; }
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
input::placeholder, textarea::placeholder { color: #b0b8c4; }
.row2 { display: flex; gap: 14px; }
.row2 > div { flex: 1; min-width: 0; }

/* ==================== 按钮 ==================== */
.btn {
  display: inline-block;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform .15s, box-shadow .2s, filter .2s;
  box-shadow: 0 2px 8px rgba(26, 77, 143, .3);
}
.btn:hover { filter: brightness(1.08); box-shadow: 0 4px 14px rgba(26, 77, 143, .35); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.block { display: block; width: 100%; }
.btn.green { background: var(--gradient-green); box-shadow: 0 2px 8px rgba(46, 139, 87, .3); }
.btn.gray { background: linear-gradient(135deg, #6b7280, #4b5563); box-shadow: 0 2px 6px rgba(75, 85, 99, .25); }
.btn.red { background: linear-gradient(135deg, #dc2626, #b91c1c); box-shadow: 0 2px 6px rgba(220, 38, 38, .25); }
.btn.small { padding: 6px 14px; font-size: 13px; border-radius: 8px; box-shadow: none; }
.btn.disabled { opacity: .45; cursor: default; pointer-events: none; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.pagination-status { color: var(--text-light); font-size: 13px; }

/* ==================== 提示 ==================== */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideDown .3s ease;
}
.flash.ok { background: var(--accent-light); color: #1e6b40; border: 1px solid #b7e0c3; }
.flash.error { background: #fdeaea; color: #a1302a; border: 1px solid #f5c6cb; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ==================== 表格 ==================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th, td { border-bottom: 1px solid var(--border); padding: 9px 12px; text-align: center; white-space: nowrap; }
th {
  background: linear-gradient(180deg, #f3f7fc, #e8eef7);
  color: var(--primary);
  font-weight: 600;
  position: sticky;
  top: 0;
}
tr:hover td { background: #f6faff; }
td.left, th.left { text-align: left; white-space: normal; min-width: 90px; }

/* ==================== 菜单网格（主页/干部端入口） ==================== */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.menu-item {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 14px 16px;
  text-align: center;
  text-decoration: none;
  color: var(--primary);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .2s ease, border-color .2s;
  overflow: hidden;
}
.menu-item::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity .2s;
}
.menu-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.menu-item:hover::before { opacity: 1; }
.menu-item .icon { font-size: 32px; display: block; margin-bottom: 10px; }
.menu-item .name { font-size: 15px; font-weight: 700; color: var(--text); }
.menu-item .desc { font-size: 12px; color: var(--text-light); margin-top: 5px; line-height: 1.5; }
.menu-item:active { transform: scale(.97); }

/* 填报状态角标 */
.menu-item .badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: #e5e7eb;
  color: #6b7280;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
/* 临时表格右上角三角形感叹号标记 */
.temp-corner {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 17px;
  line-height: 1;
  z-index: 2;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.15));
}
.menu-item .badge.ok { background: var(--gradient-green); color: #fff; }
.menu-item .badge.progress { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }
.menu-item.done {
  background: linear-gradient(180deg, #f2faf4, #e9f6ed);
  border-color: #9fd4b3;
}
.menu-item.done::before { background: var(--gradient-green); opacity: 1; }
.menu-item.done .name { color: #1e6b40; }

/* 未填提醒：待填卡片橙色描边 + 顶部提醒条 */
.menu-item.pending {
  border-color: #f0b45a;
  border-style: solid;
  background: linear-gradient(180deg, #fffdf7, #fff8ea);
}
.menu-item.pending::before { background: linear-gradient(135deg, #f59e0b, #f97316); opacity: 1; }
.pending-bar {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff7e6;
  border: 1px solid #f0c36b;
  color: #8a5a00;
  font-size: 13px;
  line-height: 1.6;
}
.pending-bar b { color: #d97706; font-size: 15px; }

/* 临时表格滚动提示（红色加粗） */
.temp-alert {
  margin: 0 0 14px;
  border-radius: 10px;
  background: #fdeaea;
  border: 1.5px solid #e0a3a3;
  overflow: hidden;
  padding: 0 6px;
}
.temp-alert marquee,
.temp-alert marquee span {
  color: #d40000 !important;
  font-weight: 800 !important;
  font-size: 15px;
  line-height: 2.1;
  font-family: inherit;
}

/* ==================== 统计块 ==================== */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-box {
  flex: 1; min-width: 110px;
  background: linear-gradient(160deg, #f4f8fd, #eaf1fa);
  border: 1px solid #dce7f5;
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  transition: transform .15s;
}
.stat-box:hover { transform: translateY(-2px); }
.stat-box .num { font-size: 20px; font-weight: 800; color: var(--primary); }
.stat-box .lab { font-size: 12px; color: var(--text-light); margin-top: 3px; }

/* ==================== 登录页 ==================== */
.login-page {
  min-height: 100vh;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before, .login-page::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.login-page::before { width: 420px; height: 420px; top: -120px; right: -100px; }
.login-page::after { width: 320px; height: 320px; bottom: -90px; left: -80px; }
.login-box {
  width: 100%;
  max-width: 430px;
  min-width: 0;
  overflow: hidden;
  background: rgba(255,255,255,.97);
  border-radius: 20px;
  padding: 34px 30px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 2;
  backdrop-filter: blur(8px);
}
.login-title { text-align: center; margin-bottom: 22px; }
.login-title .logo { font-size: 42px; margin-bottom: 6px; }
.login-title h2 { color: var(--primary); font-size: 21px; font-weight: 800; letter-spacing: 1px; }
.login-title p { color: var(--text-light); font-size: 13px; margin-top: 5px; }
.login-title .bar { width: 42px; height: 3px; background: var(--gradient); margin: 12px auto 0; border-radius: 3px; }

/* ==================== 客流表输入 ==================== */
.station-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.station-row .sname { width: 92px; font-size: 14px; color: var(--text); font-weight: 600; flex-shrink: 0; }
.station-row input { width: 74px; padding: 8px 6px; font-size: 14px; text-align: center; }
.station-row .label { font-size: 12px; color: var(--text-light); }
.station-row .onboard { color: var(--primary); font-weight: 700; }

/* ==================== 工具条 ==================== */
.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.toolbar .item { flex: 1; min-width: 140px; }
.toolbar .item label { margin: 0 0 5px; }

.hint { font-size: 13px; color: var(--text-light); margin: 8px 0; }

/* ==================== 首页大入口 ==================== */
.welcome-hero {
  background: var(--gradient);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.welcome-hero h2 { color: #fff; font-size: 19px; font-weight: 800; margin-bottom: 6px; }
.welcome-hero p { opacity: .92; font-size: 13.5px; }
.welcome-hero.hero-done { background: var(--gradient-green); box-shadow: 0 4px 16px rgba(46, 139, 87, .35); }
.entry-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.entry-btns .btn { min-width: 150px; padding: 14px 28px; font-size: 16px; background: rgba(255,255,255,.16); box-shadow: none; border: 1.5px solid rgba(255,255,255,.4); backdrop-filter: blur(4px); }
.entry-btns .btn:hover { background: rgba(255,255,255,.28); }
.entry-btns .btn.primary-solid { background: #fff; color: var(--primary); border-color: #fff; }

/* ==================== 自定义日期选择器 ==================== */
.datepicker-wrap { position: relative; }
.datepicker-input {
  cursor: pointer;
  background: #fff;
}
.datepicker-cal {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 300;
  width: 300px;
  max-width: 90vw;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 32px rgba(16, 42, 84, .18);
  padding: 14px;
}
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-title { font-size: 15px; font-weight: 700; color: var(--primary); }
.cal-nav {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--border); background: #f5f8fc; color: var(--primary);
  font-size: 17px; cursor: pointer; line-height: 1;
}
.cal-nav:active { background: #e2ebf7; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week { text-align: center; font-size: 12px; color: var(--text-light); padding: 4px 0; font-weight: 600; }
.cal-empty { height: 34px; }
.cal-day {
  height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 14px; cursor: pointer; color: var(--text);
}
.cal-day:hover { background: #eef3fa; }
.cal-day.today { color: var(--primary-light); font-weight: 700; }
.cal-day.selected { background: var(--gradient); color: #fff; font-weight: 700; }

/* ==================== 自动保存提示 ==================== */
.autosave-status {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  animation: slideDown .3s ease;
}
.autosave-status.ok { background: var(--accent-light); color: #1e6b40; border: 1px solid #b7e0c3; }
.autosave-status.err { background: #fdeaea; color: #a1302a; border: 1px solid #f5c6cb; }

/* ==================== 响应式 ==================== */
@media (max-width: 640px) {
  .container { padding: 14px 12px 32px; }
  .menu-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .menu-item { padding: 16px 8px 12px; }
  .menu-item .icon { font-size: 26px; }
  .row2 { flex-direction: column; gap: 0; }
  .toolbar .item { flex: 1 1 45%; }
  .topbar { padding: 12px 14px; }
  .topbar h1 { font-size: 16px; max-width: 58vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .login-box { padding: 26px 20px; }
  /* 表格小屏：更紧凑 + 提示可横向滑动 */
  table { font-size: 12px; }
  th, td { padding: 7px 8px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .pending-bar { font-size: 12px; padding: 8px 10px; }
  .stat-box { min-width: 88px; padding: 10px 8px; }
  .stat-box .num { font-size: 17px; }
  .train-tab { padding: 11px 6px; font-size: 14px; }
  .station-row { gap: 6px; }
}

/* ==================== 定稿登录入口与登录卡片 ====================
   首页使用定稿样图作为视觉底图，HTML 入口保持可点击；
   车长/干部登录页保留纯登录卡片，不再显示上方风景图。 */
:root { --login-navy: #073d82; --login-blue: #126bd5; --login-ice: #edf7ff; }

.portal-page {
  position: relative;
  display: block;
  width: 100%;
  height: max(100svh, min(216.2vw, 1844px));
  min-height: 620px;
  padding: 0;
  overflow: hidden;
  background: var(--login-ice) url("portal-concept-v2.png") center top / min(100%, 853px) auto no-repeat;
}
.portal-page::before, .portal-page::after { display: none; }
.portal-hero-copy { display: none; }
.portal-box {
  position: relative;
  width: min(853px, 100%);
  height: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: visible;
}
.portal-box > .rail-mark, .portal-box .login-title, .portal-divider, .portal-slogan { display: none !important; }
.portal-actions {
  position: absolute;
  top: 65.4%;
  left: 5.7%;
  right: 5.7%;
  height: 24%;
  display: flex;
  flex-direction: column;
  gap: 2.2%;
  margin: 0;
  z-index: 2;
}
.entry-action {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.entry-action:hover { transform: none; box-shadow: none; }
.entry-action:focus-visible { transform: none; box-shadow: none; outline: 3px solid rgba(18,107,213,.5); outline-offset: -3px; }

.form-login-page {
  min-height: 100svh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(24px, 8vh, 82px) 16px 32px;
  overflow: auto;
  background: linear-gradient(150deg, #eaf5ff 0%, #f8fbff 58%, #e5f2ff 100%);
}
.form-login-page::before, .form-login-page::after { display: none; }
.form-login-box {
  width: min(560px, 100%);
  max-width: none;
  padding: clamp(28px, 5vw, 42px) clamp(20px, 5vw, 38px) 30px;
  border: 1px solid #d6e7f5;
  border-radius: 26px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 16px 38px rgba(17,77,130,.16);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.form-login-box .login-title { margin-bottom: 24px; }
.form-login-box .login-title h2 { color: var(--login-navy); font-size: clamp(24px, 6vw, 30px); letter-spacing: 1px; }
.form-login-box .login-title p { color: #63799a; font-size: 14px; }
.form-login-box label { color: #31516c; font-weight: 650; }
.form-login-box input, .form-login-box select { height: 48px; border-color: #d8e3f0; border-radius: 12px; }
.form-login-box .btn { height: 52px; border-radius: 12px; background: linear-gradient(110deg,#0758c4,#2789f4); }
.rail-mark {
  width: 58px; height: 32px; margin: 0 auto 11px; display: flex; align-items: end; justify-content: center;
  gap: 3px; padding: 5px 7px 7px; border: 1px solid #bdd9ef; border-radius: 8px 8px 5px 5px;
  background: linear-gradient(180deg, #fafdff, #e7f3fc); position: relative;
}
.rail-mark::before { content: ""; position: absolute; top: 5px; left: 8px; right: 8px; height: 7px; border-radius: 2px; background: #1261a4; }
.rail-mark::after { content: ""; position: absolute; bottom: 3px; left: 5px; right: 5px; height: 2px; background: #1764a4; box-shadow: 0 4px 0 #1764a4; }
.rail-mark i { width: 4px; height: 4px; border-radius: 50%; background: #1764a4; position: relative; z-index: 1; }
.eyebrow { display: block; margin-bottom: 8px; color: #37739f; font-size: 11px; font-weight: 800; letter-spacing: 1.4px; }

/* 两端卡片标题与注解始终分行，避免小屏挤在同一行。 */
.menu-item .name, .menu-item .desc { display: block; }
.menu-item .desc { margin-top: 5px; line-height: 1.5; }

@media (min-width: 1025px) {
  .portal-page { background-size: 853px auto; }
}
@media (max-width: 640px) {
  /* iPhone 竖屏等比覆盖，按屏幕比例只裁切边缘，避免背景上下显得偏长。 */
  .portal-page {
    min-height: 0;
    height: 100svh;
    background-size: cover;
    background-position: center center;
  }
  .portal-actions { top: 63.4%; left: 5.7%; right: 5.7%; }
  .form-login-page { padding: 20px 14px 28px; }
  .form-login-box { border-radius: 22px; padding: 28px 20px 24px; }
}
