* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: linear-gradient(180deg, #f3f7fb 0%, #eef3f7 100%);
  color: #1f2937;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.hidden { display: none !important; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(31,78,120,0.14), transparent 38%),
    radial-gradient(circle at bottom right, rgba(16,185,129,0.12), transparent 28%),
    #eef3f7;
}
.login-card {
  width: min(460px, 100%);
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(31,78,120,0.08);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.12);
}
.login-eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1f4e78;
  font-weight: 700;
}
.login-card h1 { margin: 8px 0 10px; font-size: 32px; }
.login-subtitle { margin: 0 0 24px; color: #64748b; line-height: 1.6; }
.login-form { display: grid; gap: 16px; }
.login-form label, .grid-form label {
  display: grid;
  gap: 8px;
}
.login-form span, .grid-form span { font-size: 13px; color: #475569; font-weight: 600; }
input, select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid #d0dae5;
  background: #fff;
}
input:focus, select:focus {
  outline: none;
  border-color: #1f4e78;
  box-shadow: 0 0 0 3px rgba(31,78,120,0.12);
}
.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: #1f4e78; color: #fff; box-shadow: 0 12px 24px rgba(31,78,120,0.18); }
.btn-secondary { background: #e2e8f0; color: #0f172a; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-ghost { background: transparent; color: #475569; border: 1px solid #cbd5e1; }
.btn-block { width: 100%; }
.login-tip {
  margin-top: 20px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.7;
  color: #475569;
}
.flash-stack { margin-bottom: 16px; }
.flash {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 8px;
}
.flash.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

.app-shell { padding: 20px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  background: rgba(255,255,255,0.92);
  border-radius: 22px;
  border: 1px solid rgba(31,78,120,0.08);
  box-shadow: 0 16px 40px rgba(15,23,42,0.08);
}
.topbar h1 { margin: 6px 0 0; font-size: 28px; }
.brand-tag { font-size: 12px; color: #1f4e78; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.userbox {
  min-width: 150px;
  padding: 10px 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
#currentUserName { font-weight: 700; }
#currentUserRole { font-size: 12px; color: #64748b; margin-top: 4px; }

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}
.tabbar button {
  background: rgba(255,255,255,0.88);
  border: 1px solid #d7e0ea;
  color: #334155;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}
.tabbar button.active {
  background: #1f4e78;
  color: #fff;
  border-color: #1f4e78;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.card {
  background: rgba(255,255,255,0.93);
  border-radius: 22px;
  padding: 20px;
  border: 1px solid rgba(31,78,120,0.08);
  box-shadow: 0 16px 36px rgba(15,23,42,0.06);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.metric-card {
  background: linear-gradient(135deg, #0f172a 0%, #1f4e78 100%);
  color: #fff;
  border-radius: 20px;
  padding: 20px;
  min-height: 150px;
}
.metric-label { font-size: 13px; opacity: 0.8; }
.metric-value { font-size: 34px; font-weight: 800; margin-top: 16px; }
.metric-desc { margin-top: 10px; font-size: 13px; color: rgba(255,255,255,0.82); line-height: 1.6; }

.two-col {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.card-head h2 { margin: 0; font-size: 20px; }
.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.upload-form, .single-upload {
  display: grid;
  gap: 12px;
  background: #f8fafc;
  border: 1px dashed #b8c6d8;
  border-radius: 18px;
  padding: 16px;
}
.upload-form h3 { margin: 0; font-size: 16px; }
.meta-note {
  margin: 14px 0;
  color: #64748b;
  font-size: 13px;
}
.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}
table.data-table th, table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}
table.data-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #334155;
  font-weight: 800;
}
table.data-table tr:nth-child(even) td { background: #fbfdff; }
table.data-table td.number { text-align: right; font-variant-numeric: tabular-nums; }
.details-block { margin-top: 16px; }
.details-block summary { cursor: pointer; font-weight: 700; color: #334155; margin-bottom: 10px; }
.top-gap { margin-top: 14px; }

.panel {
  margin: 18px 0;
  padding: 18px;
  background: rgba(255,255,255,0.93);
  border-radius: 20px;
  border: 1px solid rgba(31,78,120,0.08);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.grid-form button { align-self: end; }
.user-form { margin-bottom: 18px; }

.toast {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
}
.toast.success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.toast.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

@media (max-width: 980px) {
  .two-col { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-right { justify-content: space-between; flex-wrap: wrap; }
}
