/* ==========================================================================
   蓬莱矿业采掘数据管理与分析系统 — 界面样式
   设计语言参考：齐家沟分矿仓储管理系统（同单位既有系统），保持风格统一
   ========================================================================== */

:root {
  --blue: #1B6FC4;
  --blue-hi: #2E86DA;
  --blue-soft: #EAF3FC;
  --blue-line: #CBE0F5;
  --green: #1FA35C;
  --orange: #E8892B;
  --red: #D64C43;
  --nav: #1A1E27;
  --nav-hover: #252A35;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --text: #1F2733;
  --text-2: #5C6779;
  --text-3: #8A94A6;
  --line: #E8EBF0;
  --line-2: #F1F3F6;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow-card: 0 1px 2px rgba(20, 40, 70, .04);
  --shadow-pop: 0 18px 50px rgba(10, 30, 60, .18);
}

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

html, body { height: 100%; }

body {
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; font-size: inherit; }
a { color: var(--blue); }

/* ---------------------------------------------------------------- 登录页 */
#login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
  padding: 48px clamp(28px, 7vw, 120px);
  background-color: #0C1B2C;
  background-image:
    linear-gradient(180deg, rgba(7, 17, 28, 0) 52%, rgba(7, 17, 28, .42) 100%),
    linear-gradient(90deg, rgba(7, 17, 28, .04) 0%, rgba(7, 17, 28, .16) 42%, rgba(7, 17, 28, .55) 100%),
    url("../img/login-bg.jpg?v=3.4.3");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.login-slogan {
  position: absolute;
  left: clamp(28px, 5vw, 76px);
  bottom: clamp(26px, 5vh, 54px);
  z-index: 2;
  color: rgba(255, 255, 255, .94);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 6px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .6);
}
.login-slogan::before {
  content: "";
  display: block;
  width: 34px; height: 2px;
  margin-bottom: 12px;
  background: #E8892B;
}

@media (max-width: 980px) {
  #login { justify-content: center; padding: 24px; background-position: 62% center; }
  .login-slogan { display: none; }
  .login-card { width: min(396px, 100%); }
}

@media (max-height: 720px) {
  #login { align-items: flex-start; padding-top: 24px; padding-bottom: 24px; overflow-y: auto; }
}

.login-card {
  position: relative;
  z-index: 3;
  width: 396px;
  background: #fff;
  border-radius: 14px;
  padding: 38px 36px 28px;
  box-shadow: 0 24px 70px rgba(6, 18, 32, .34), 0 2px 8px rgba(6, 18, 32, .12);
}

.login-brand { text-align: center; margin-bottom: 26px; }

.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin-bottom: 16px;
}

.login-logo .mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(145deg, #F2A13C, #E8752B);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(232, 117, 43, .32);
  flex-shrink: 0;
}

.login-logo .mark svg { width: 19px; height: 19px; }

.login-logo .org {
  font-size: 12px; color: var(--text-2); letter-spacing: .3px;
}

.login-brand h1 {
  font-size: 21px; font-weight: 600; letter-spacing: .5px; color: var(--text);
}

.login-brand .sub {
  margin-top: 8px; font-size: 12.5px; color: var(--text-3);
}

.field { margin-bottom: 15px; }

.field label {
  display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 7px;
}

.field input {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #FBFCFD; color: var(--text); outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}

.field input::placeholder { color: #B4BCC8; }

.field input:focus {
  border-color: var(--blue-hi); background: #fff;
  box-shadow: 0 0 0 3px rgba(46, 134, 218, .12);
}

.btn-login {
  width: 100%; height: 43px; margin-top: 10px;
  border: none; border-radius: var(--radius); cursor: pointer;
  background: linear-gradient(180deg, var(--blue-hi), var(--blue));
  color: #fff; font-size: 14.5px; font-weight: 500; letter-spacing: 3px;
  transition: filter .16s, transform .12s;
}

.btn-login:hover { filter: brightness(1.06); }
.btn-login:active { transform: translateY(1px); }
.btn-login:disabled { opacity: .6; cursor: not-allowed; }

.login-err {
  min-height: 17px; margin-top: 11px;
  font-size: 12.5px; color: var(--red); text-align: center;
}

.login-foot {
  margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line-2);
  font-size: 11.5px; color: #A6AEB9; text-align: center; letter-spacing: 1px;
}
.login-beian { margin-top: 6px; font-size: 10.5px; letter-spacing: 0; color: #7F8A98; }
.login-beian a { color: inherit; text-decoration: none; }
.login-beian a:hover { color: #C9D3E0; text-decoration: underline; }
.beian-ico { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; }

/* ---------------------------------------------------------------- 主框架 */
#app { display: none; height: 100vh; }

.layout { display: flex; height: 100vh; }

/* 侧栏：固定宽度，禁止收缩（参考系统在此处出现过被挤成竖排字的问题） */
.sidebar {
  width: 170px;
  flex: 0 0 170px;
  min-width: 170px;
  background: var(--nav);
  display: flex;
  flex-direction: column;
  color: #A9B3C2;
  overflow: hidden;
}

.sb-brand {
  height: 56px; flex-shrink: 0;
  display: flex; align-items: center; gap: 9px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.sb-logo {
  width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(145deg, #F2A13C, #E8752B);
  display: flex; align-items: center; justify-content: center;
}

.sb-logo svg { width: 15px; height: 15px; }

.sb-brand h2 {
  font-size: 12.5px; font-weight: 500; color: #E6EBF2; white-space: nowrap;
}

.sb-nav { padding: 8px 0; flex: 1; overflow-y: auto; overflow-x: hidden; }

.sb-group {
  padding: 13px 16px 6px; font-size: 10.5px; color: #5B6678;
  letter-spacing: 1.2px; white-space: nowrap;
}

.nav-item {
  display: flex; align-items: center; gap: 9px;
  height: 40px; padding: 0 16px;
  cursor: pointer; font-size: 13px; color: #A9B3C2;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
  user-select: none; white-space: nowrap;
}

.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .85; }

.nav-item:hover { background: var(--nav-hover); color: #D8DFE9; }

.nav-item.active {
  background: rgba(46, 134, 218, .16);
  border-left-color: var(--blue-hi);
  color: #63AEFF;
}

.sb-foot {
  flex-shrink: 0;
  padding: 11px 16px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: 11px; color: #5B6678;
  display: flex; justify-content: space-between; gap: 6px;
  white-space: nowrap; overflow: hidden;
}

.sb-foot b { color: #8C97A8; font-weight: 400; }

.sb-beian {
  flex-shrink: 0;
  padding: 0 12px 12px;
  font-size: 10px; line-height: 1.5;
  color: #7C8794; letter-spacing: 0; text-align: center;
  word-break: break-all;
}
.sb-beian a { color: inherit; text-decoration: none; }
.sb-beian a:hover { color: #8C97A8; text-decoration: underline; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* 顶部品牌栏 */
.app-header {
  height: 56px; flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-logo {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(145deg, #F2A13C, #E8752B);
  display: flex; align-items: center; justify-content: center;
}

.brand-logo svg { width: 17px; height: 17px; }

.brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.brand-org {
  font-size: 10.5px; color: var(--text-3); letter-spacing: .2px;
  white-space: nowrap;
}

.brand-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  letter-spacing: .3px; white-space: nowrap;
}

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

.cutoff {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 14px;
  background: #FFF8E8; border: 1px solid #F3E2B8;
  font-size: 12px; color: #8A6D12; white-space: nowrap;
}

.cutoff i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--orange); display: inline-block;
}

.btn-ghost {
  height: 30px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--text-2);
  cursor: pointer; font-size: 12.5px;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}

.btn-ghost:hover { border-color: var(--blue-line); color: var(--blue); background: #FAFCFF; }

.user-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-2);
  white-space: nowrap;
}

.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue-soft); color: var(--blue);
  font-size: 12px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
}

/* 三级抬头：一级固定 / 二级分矿 / 三级矿井，两个下拉并排 */
.org-bar {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 18px;
  padding: 9px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.org-field { display: flex; align-items: center; gap: 7px; }

.org-field label {
  font-size: 11.5px; color: var(--text-3);
  letter-spacing: .3px;
}

.org-field select {
  height: 30px; min-width: 128px;
  padding: 0 26px 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #FBFCFD; color: var(--text);
  font-size: 13px; outline: none; cursor: pointer;
}

.org-field select:focus { border-color: var(--blue-hi); background: #fff; }
.org-field select:disabled { color: var(--text-3); background: #F7F8FA; cursor: not-allowed; }
.org-field.is-off label { opacity: .5; }

.org-scope {
  margin-left: auto;
  font-size: 12.5px; color: var(--text-2);
  display: flex; align-items: center; gap: 7px;
}

.scope-tag {
  font-size: 11px; color: var(--blue);
  background: var(--blue-soft);
  border-radius: 3px; padding: 2px 6px;
}

/* 计划完成率页：年度 / 季度 / 月度，形态照抄顶部组织抬头 */
.period-bar {
  display: flex; align-items: center; gap: 18px;
  flex-wrap: wrap;
  padding: 9px 14px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.period-bar .org-field select { min-width: 104px; }

.period-scope {
  margin-left: auto;
  font-size: 12.5px; color: var(--text-2);
}

.content { flex: 1; overflow-y: auto; padding: 18px 20px 28px; }

.page-title {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 14px;
}

.page-title h3 { font-size: 15px; font-weight: 600; }

.page-title span { font-size: 12px; color: var(--text-3); }

.page { display: none; }
.page.active { display: block; animation: fade .2s ease; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.card-hd {
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line-2);
}

.card-hd h4 { font-size: 14px; font-weight: 600; }

.card-hd .hint { font-size: 11.5px; color: var(--text-3); font-weight: 400; }

.card-bd { padding: 16px 18px; }

/* 卡片头右侧：说明文字 + 对比年度下拉 */
.card-hd .hd-right { display: flex; align-items: center; gap: 10px; }

.mini-pick {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-3);
}

.mini-pick select {
  height: 26px; padding: 0 20px 0 7px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #FBFCFD; color: var(--text);
  font-size: 12px; outline: none; cursor: pointer;
}

.mini-pick select:focus { border-color: var(--blue-hi); background: #fff; }
.mini-pick select:disabled { color: var(--text-3); background: #F7F8FA; cursor: not-allowed; }

/* 指标卡：居中大数字 */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 16px 18px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.kpi-value {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.6px;
  line-height: 1.15;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.kpi.green .kpi-value { color: var(--green); }
.kpi.gold .kpi-value { color: var(--blue); }
.kpi.orange .kpi-value { color: var(--orange); }

.kpi-label {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center; gap: 5px;
}

.kpi-meta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-2);
  display: flex; justify-content: center; gap: 12px;
  font-size: 11.5px; color: var(--text-3);
  flex-wrap: wrap;
}

.delta { font-variant-numeric: tabular-nums; }
.delta.up { color: var(--red); }
.delta.down { color: var(--green); }
.delta.flat { color: var(--text-3); }

.kpi-sub {
  margin-top: 7px;
  font-size: 11.5px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.kpi-sub b { color: var(--text-2); font-weight: 500; }

.unit-mini { font-size: 10px; color: var(--text-3); margin-left: 1px; }

/* 计划完成率明细表：计划/验收/完成率三列一组 */
table.data.completion { font-size: 12.5px; }
table.data.completion th { white-space: nowrap; }
table.data.completion .th-unit {
  display: block; font-size: 10px; color: var(--text-3); font-weight: 400;
}
table.data.completion td { padding: 7px 10px; }
table.data.completion .rate { font-variant-numeric: tabular-nums; color: var(--text-2); }
table.data.completion .rate.ok { color: var(--red); }
table.data.completion tr.sum td {
  background: #FAFCFF; border-top: 1px solid var(--line); font-weight: 500;
}

/* ---------------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }

table.data th {
  text-align: right; padding: 11px 14px;
  font-weight: 500; color: var(--text-2); font-size: 12.5px;
  white-space: nowrap;
  background: #FAFBFC;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}

table.data th:first-child, table.data td:first-child { text-align: left; }

table.data td {
  padding: 11px 14px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--line-2);
  font-variant-numeric: tabular-nums;
}

table.data tbody tr:hover { background: #FAFCFF; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tr.sum td {
  background: #FAFCFF; border-top: 1px solid var(--line); font-weight: 500;
}

.num { font-variant-numeric: tabular-nums; }
.dim { color: var(--text-3); }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 3px;
  font-size: 11.5px; background: #F2F4F7; color: #5C6779;
}

.tag.ok { background: #E9F7EF; color: #17804A; }
.tag.warn { background: #FEF4E6; color: #97690F; }
.tag.err { background: #FDEDEC; color: #B03A31; }
.tag.gold { background: var(--blue-soft); color: var(--blue); }

/* ---------------------------------------------------------------- 控件 */
.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 13px;
}

.toolbar .lbl { font-size: 12.5px; color: var(--text-3); }

select, .input {
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--text); outline: none; cursor: pointer;
  transition: border-color .15s;
}

select:hover, .input:hover { border-color: #D3DAE4; }
select:focus, .input:focus { border-color: var(--blue-hi); }

.btn {
  height: 32px; padding: 0 14px;
  border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}

.btn:hover { background: #FAFCFF; border-color: var(--blue-line); color: var(--blue); }

.btn-primary {
  background: var(--blue); border-color: var(--blue); color: #fff;
}

.btn-primary:hover { background: var(--blue-hi); border-color: var(--blue-hi); color: #fff; }

.btn-danger { border-color: #F0C9C5; color: var(--red); }
.btn-danger:hover { background: #FDF3F2; border-color: var(--red); color: var(--red); }

.btn:disabled { opacity: .55; cursor: not-allowed; }

.seg {
  display: inline-flex; background: #F2F4F7; border-radius: var(--radius); padding: 2px;
}

.seg button {
  border: none; background: transparent; padding: 6px 13px;
  border-radius: 4px; cursor: pointer; font-size: 12.5px; color: var(--text-2);
  transition: background .15s, color .15s;
}

.seg button.on { background: #fff; color: var(--blue); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }

/* ---------------------------------------------------------------- 图表 */
.chart { width: 100%; height: 330px; }
.chart-sm { width: 100%; height: 262px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- 上传 */
.dropzone {
  border: 1.5px dashed #CBD6E3;
  border-radius: var(--radius-lg);
  padding: 34px 24px; text-align: center; cursor: pointer;
  background: #FBFCFE;
  transition: border-color .18s, background .18s;
}

.dropzone:hover, .dropzone.over {
  border-color: var(--blue-hi); background: #F6FAFE;
}

.dropzone svg { width: 38px; height: 38px; opacity: .45; margin-bottom: 11px; color: var(--blue); }

.dropzone h5 { font-size: 14px; font-weight: 500; margin-bottom: 6px; }

.dropzone p { font-size: 12.5px; color: var(--text-3); line-height: 1.75; }

.result-list { margin-top: 14px; display: flex; flex-direction: column; gap: 9px; }

.result-item {
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: #FBFCFE; font-size: 12.8px;
}

.result-item.ok { border-color: #C8E9D6; background: #F5FBF7; }
.result-item.fail { border-color: #F2CFC9; background: #FDF7F6; }

.result-item .rt {
  display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px;
}

.result-item .rt b { font-weight: 600; }

.check-line { font-size: 11.8px; color: var(--text-3); line-height: 1.9; }

.empty {
  padding: 44px 20px; text-align: center; color: var(--text-3); font-size: 13px;
}

.empty svg { width: 42px; height: 42px; opacity: .3; margin-bottom: 11px; }

.loading { padding: 38px; text-align: center; color: var(--text-3); font-size: 13px; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 99;
  padding: 11px 17px; border-radius: var(--radius);
  font-size: 13px;
  background: #22303F; color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  opacity: 0; transform: translateY(8px);
  transition: opacity .22s, transform .22s;
  pointer-events: none; max-width: 420px;
}

.toast.show { opacity: 1; transform: none; }
.toast.err { background: #8E2B22; }

/* 说明条 */
.note-bar {
  display: none;
  margin: -2px 0 14px;
  font-size: 12px; color: #8A6D12;
  background: #FFF9E8; border: 1px solid #F3E2B8;
  border-radius: var(--radius); padding: 8px 13px; line-height: 1.7;
}

/* 在线录入：表格里直接编辑，平时不显示边框，聚焦才出现 */
table.data.entry th { white-space: nowrap; font-size: 11.5px; padding: 6px 5px; }
table.data.entry td { padding: 2px 4px; }
table.data.entry tbody tr:hover { background: #FBFDFF; }
.cell-in {
  width: 100%; border: 1px solid transparent; background: transparent;
  padding: 3px 4px; font: inherit; color: inherit; border-radius: 3px;
}
.cell-in:hover { border-color: var(--line); background: #fff; }
.cell-in:focus { outline: none; border-color: var(--blue); background: #fff; }
table.data.entry select {
  border: 1px solid transparent; background: transparent; font: inherit;
  color: inherit; padding: 2px; border-radius: 3px;
}
table.data.entry select:hover { border-color: var(--line); }
.entry-totals {
  margin-top: 10px; font-size: 12.5px; color: #3C4B5C;
  background: #F6F9FC; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 13px; line-height: 1.8;
}
.entry-totals b { color: var(--navy, #1E4A75); font-weight: 600; }
