/* ==========================================================================
   app.css —— 应用骨架布局：顶栏 / 导航 / 内容区 / 卡片 / 图表
   ========================================================================== */

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  height: 54px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: #111827;
  white-space: nowrap;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--tone);
  color: #fff;
  font-size: 13px;
}

/* 前端构建号：让「浏览器里跑的是不是最新前端」可被肉眼确认 */
.brand-version {
  margin-left: 2px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
  cursor: help;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  height: 100%;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 100%;
  padding: 0 12px;
  color: #374151;
  font-size: 13px;
  white-space: nowrap;
  border-radius: 0;
}

.nav-item:hover {
  text-decoration: none;
  background: #f9fafb;
  color: var(--tone);
}

.nav-divider {
  color: #d1d5db;
  padding: 0 2px;
  font-size: 12px;
}

.nav-icon {
  font-size: 12px;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 13px;
  color: #374151;
}

.user-identity {
  color: #4b5563;
}

.role-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid transparent;
}

.role-super_admin {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.role-province_admin {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.role-viewer {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #4b5563;
}

/* ---------- 面包屑 ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.crumb-home {
  color: #9ca3af;
}

.crumb-sep {
  color: #d1d5db;
}

.crumb:last-child {
  color: #374151;
}

/* ---------- 内容区 ---------- */
.view {
  flex: 1;
  padding: 12px 20px 40px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.page-head-left {
  flex: 1;
  min-width: 0;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
}

.page-title-icon {
  font-size: 16px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.scope-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- 筛选栏 ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
}

.filter-range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.filter-dash {
  color: #9ca3af;
}

.filter-bar .input,
.filter-bar .select {
  width: 150px;
}

.filter-bar .filter-range .input {
  width: 140px;
}

/* ---------- 卡片 ---------- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 14px;
  margin-bottom: 10px;
  color: #111827;
}

.muted-card {
  color: var(--text-muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

/* ---------- 详情 ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px 20px;
}

.kv {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed #eef0f3;
  font-size: 13px;
}

.kv-label {
  color: var(--text-muted);
  flex: 0 0 44%;
}

.kv-value {
  color: #111827;
  word-break: break-word;
}

.complete-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.confirm-body p {
  margin-bottom: 8px;
  font-size: 13px;
}

.confirm-strong {
  font-weight: 600;
  color: #111827;
}

/* ---------- 导入 ---------- */
.import-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}

.import-summary .sep {
  color: #d1d5db;
}

.result-holder {
  margin-top: 12px;
}

.reason-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reason-error {
  color: #b91c1c;
}

.reason-warn {
  color: #b45309;
}

/* ---------- 审计日志 ---------- */
.row-log {
  cursor: pointer;
}

.row-log.is-expanded {
  background: #f9fafb;
}

.row-detail td {
  background: #fafbfc;
}

.detail-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #4b5563;
  word-break: break-all;
}

.is-hidden {
  display: none;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: #4b5563;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.is-active {
  color: var(--tone);
  border-bottom-color: var(--tone);
  font-weight: 600;
}

.tab-content {
  min-height: 80px;
}

/* ---------- 统计 ---------- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 12px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}

.stat-pending {
  color: #1d4ed8;
}

.stat-done {
  color: #047857;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-line {
  font-size: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(140px, 240px) 1fr 48px;
  align-items: center;
  gap: 10px;
}

.bar-label {
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  display: block;
  height: 12px;
  background: #f3f4f6;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--tone);
}

.bar-count {
  color: #4b5563;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 140px;
  padding-top: 8px;
}

.trend-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.trend-bar {
  display: block;
  width: 100%;
  background: var(--tone);
  border-radius: 2px 2px 0 0;
  opacity: 0.85;
}

.trend-date {
  color: #9ca3af;
  font-size: 10px;
  writing-mode: vertical-rl;
  height: 34px;
  white-space: nowrap;
}

/* ---------- 登录页 ---------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8vh 16px;
}

.login-card {
  width: 400px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  padding: 28px 26px;
}

.login-title {
  font-size: 19px;
  color: #111827;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  margin: 6px 0 20px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form .input {
  height: 38px;
}

.login-form .btn-block {
  height: 38px;
  margin-top: 4px;
}

.login-hint {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.login-hint-title {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.login-hint-body {
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.7;
  word-break: break-all;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }

  .nav {
    order: 3;
    width: 100%;
    height: 38px;
  }

  .view {
    padding: 10px 12px 32px;
  }

  .bar-row {
    grid-template-columns: minmax(90px, 140px) 1fr 40px;
  }
}
