:root {
  --page-bg: #edf2f7;
  --panel: #ffffff;
  --panel-soft: #f7faff;
  --line: #d5deeb;
  --line-strong: #aebdd0;
  --text: #1c2f46;
  --muted: #65758a;
  --blue: #0b4f93;
  --blue-deep: #07376b;
  --blue-soft: #eaf2fb;
  --red: #c51f32;
  --red-deep: #9f1928;
  --gold: #c28b2c;
  --warn: #a4262c;
  --shadow: 0 8px 22px rgba(22, 52, 88, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.2)),
    repeating-linear-gradient(90deg, rgba(12, 69, 126, 0.035) 0 1px, transparent 1px 72px),
    linear-gradient(180deg, #f6f9fd 0%, var(--page-bg) 100%);
  overflow-x: hidden;
}

.top-notice {
  position: sticky;
  top: 0;
  z-index: 4;
  border-bottom: 1px solid rgba(5, 40, 80, 0.72);
  background: linear-gradient(90deg, var(--blue-deep), var(--blue), var(--blue-deep));
  box-shadow: 0 2px 8px rgba(0, 28, 62, 0.18);
}

.top-notice-content {
  width: min(1280px, 96vw);
  margin: 0 auto;
  padding: 7px 0;
  color: #f3f8ff;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.top-notice-content::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--gold);
  vertical-align: 1px;
}

.decor,
.decor-2 {
  display: none;
}

main {
  position: relative;
  z-index: 1;
  width: min(1280px, 96vw);
  margin: 18px auto 34px;
  display: grid;
  gap: 16px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  padding: 18px 22px 16px;
  border-top: 4px solid var(--red);
  background:
    linear-gradient(90deg, rgba(7, 55, 107, 0.055), transparent 52%),
    linear-gradient(180deg, #ffffff, #f8fbff);
}

.hero::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 34%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--blue));
}

.hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

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

.gov-emblem {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid rgba(197, 31, 50, 0.24);
  border-radius: 50%;
  color: #ffffff;
  background:
    radial-gradient(circle at 50% 44%, #e6424e 0 18%, transparent 19%),
    linear-gradient(145deg, var(--red), var(--red-deep));
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.18);
  font-size: 1.15rem;
  font-weight: 700;
}

.gov-kicker {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

h1 {
  margin: 0;
  color: var(--blue-deep);
  font-size: clamp(1.5rem, 1.22rem + 1vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

.subtitle {
  margin: 12px 0 0 68px;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.hero-actions {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

input,
button,
select {
  font: inherit;
}

input[type="text"],
input[type="file"],
input[type="search"],
select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #ffffff;
  color: var(--text);
}

input[type="text"],
input[type="search"] {
  padding: 0 11px;
}

select {
  padding: 0 9px;
}

input[type="file"] {
  padding: 5px 8px;
  font-size: 0.86rem;
}

input[type="file"]::file-selector-button {
  height: 24px;
  margin-right: 8px;
  border: 1px solid #9eb1c8;
  border-radius: 3px;
  color: var(--blue-deep);
  background: #edf4fc;
  cursor: pointer;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(11, 79, 147, 0.22);
  outline-offset: 1px;
  border-color: var(--blue);
}

.hero-actions input[type="file"] {
  width: min(360px, 56vw);
}

.btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0 14px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.btn:hover {
  box-shadow: 0 2px 8px rgba(12, 52, 96, 0.13);
}

.btn:active {
  box-shadow: none;
}

.btn-primary {
  color: #ffffff;
  border-color: var(--blue-deep);
  background: linear-gradient(180deg, #1264ad, var(--blue));
  font-weight: 700;
  white-space: nowrap;
}

.btn-primary:hover {
  background: linear-gradient(180deg, var(--blue), var(--blue-deep));
}

.btn-secondary {
  color: var(--blue-deep);
  border-color: #9eb1c8;
  background: #ffffff;
}

.btn-secondary:hover {
  background: var(--blue-soft);
}

.btn-danger {
  color: #ffffff;
  border-color: var(--red-deep);
  background: linear-gradient(180deg, #d9434f, var(--red));
}

.result {
  border-top: 0;
  background: #ffffff;
}

.result::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--red) 0 22%, var(--blue) 22% 100%);
}

.toolbar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f4f8fd);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.toolbar-main {
  display: grid;
  gap: 8px;
}

.toolbar-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue-deep);
  font-size: 0.86rem;
  font-weight: 700;
}

.toolbar-kicker::before {
  content: "";
  width: 4px;
  height: 15px;
  background: var(--red);
}

.toolbar-search-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 8px;
}

#toggleFieldFilterBtn {
  height: 36px;
  align-self: end;
}

.toolbar-filter-panel {
  padding: 10px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.field-picker {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #c7d4e5;
  border-radius: 3px;
  background: #ffffff;
}

.field-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.field-picker-title {
  color: var(--blue-deep);
  font-size: 0.9rem;
  font-weight: 700;
}

.field-picker .btn {
  min-height: 30px;
  padding: 0 10px;
}

.field-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.field-selector.empty {
  color: var(--muted);
  font-size: 0.86rem;
}

.field-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #c3d0e0;
  border-radius: 3px;
  padding: 4px 8px;
  background: #f9fbfe;
  font-size: 0.84rem;
  user-select: none;
}

.field-check.drag-over {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.field-check.dragging {
  opacity: 0.58;
}

.field-check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.field-check input {
  accent-color: var(--blue);
}

.field-drag-handle {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1;
  padding: 0 2px;
  cursor: grab;
}

.field-drag-handle:active {
  cursor: grabbing;
}

.hidden {
  display: none !important;
}

.status {
  padding: 9px 18px;
  border-bottom: 1px solid #d5e1ef;
  border-left: 4px solid var(--blue);
  color: #123f73;
  background: #eef5fc;
  font-size: 0.86rem;
}

.status.error {
  border-left-color: var(--red);
  color: var(--warn);
  background: #fff1f2;
}

.table-wrap {
  overflow: auto;
  min-height: 38vh;
  max-height: 68vh;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  border-bottom: 1px solid #9fb0c6;
  border-right: 1px solid #d7e0ed;
  color: #ffffff;
  background: linear-gradient(180deg, #155d9e, var(--blue));
  text-align: left;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

thead th:last-child,
tbody td:last-child {
  border-right: 0;
}

.th-content {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.col-serial {
  width: 72px;
}

.col-status {
  width: 130px;
}

.col-action {
  width: 64px;
}

.sort-arrows {
  display: inline-flex;
  flex-direction: column;
  gap: 0;
}

.sort-arrow {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.64);
  font-size: 9px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.sort-arrow:hover,
.sort-arrow.active {
  color: #ffffff;
}

tbody td {
  padding: 9px 12px;
  border-right: 1px solid #e0e7f1;
  border-bottom: 1px solid #e3eaf3;
  vertical-align: middle;
  color: #24384f;
  font-size: 0.9rem;
}

tbody tr {
  cursor: pointer;
}

tbody tr:nth-child(even) td {
  background: #fbfdff;
}

tbody tr:hover td {
  background: #edf5ff;
}

tbody tr.row-clicked td {
  background: #e6f0fb;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.action-cell {
  width: 64px;
  text-align: center;
}

.delete-icon {
  width: 25px;
  height: 25px;
  border: 1px solid rgba(197, 31, 50, 0.24);
  border-radius: 3px;
  padding: 0;
  color: var(--red-deep);
  background: #fff4f5;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.delete-icon:hover {
  background: #ffe6e8;
}

.empty {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

.action-log-card {
  background: #ffffff;
}

.action-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f6f9fd);
}

.action-log-head h2 {
  margin: 6px 0 0;
  color: var(--blue-deep);
  font-size: 1.05rem;
  line-height: 1.25;
}

.action-log-list {
  max-height: 260px;
  overflow: auto;
  padding: 4px 18px 10px;
}

.action-log-item {
  display: grid;
  grid-template-columns: 156px 92px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid #e5ebf4;
  color: #263b53;
  font-size: 0.88rem;
}

.action-log-item:last-child {
  border-bottom: 0;
}

.action-log-time {
  color: var(--muted);
  font-family: Consolas, "Courier New", monospace;
  white-space: nowrap;
}

.action-log-type {
  justify-self: start;
  min-width: 72px;
  padding: 2px 8px;
  border: 1px solid #bfd0e4;
  border-radius: 3px;
  color: var(--blue-deep);
  background: var(--blue-soft);
  text-align: center;
  font-weight: 700;
}

.action-log-detail {
  min-width: 0;
  overflow-wrap: anywhere;
}

.action-log-empty {
  padding: 20px 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.site-footer {
  width: min(1280px, 96vw);
  margin: 0 auto 18px;
  padding: 12px;
  border-top: 3px solid var(--blue);
  color: #66778c;
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
  font-size: 0.82rem;
}

.site-footer a {
  color: var(--blue-deep);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--red);
  text-decoration: underline;
}

.site-footer span {
  margin: 0 8px;
  color: #9aa8ba;
}

.controls,
.grid,
.field,
.tips,
.controls-note {
  color: inherit;
}

@media (max-width: 860px) {
  main,
  .top-notice-content,
  .site-footer {
    width: min(100% - 20px, 1280px);
  }

  .hero {
    padding: 15px 14px 14px;
  }

  .hero-head {
    align-items: stretch;
  }

  .gov-brand {
    width: 100%;
    align-items: flex-start;
  }

  .gov-emblem {
    width: 46px;
    height: 46px;
    font-size: 1rem;
  }

  .subtitle {
    margin-left: 0;
    font-size: 0.84rem;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions input[type="file"],
  .hero-actions .btn {
    width: 100%;
  }

  .toolbar {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .toolbar-search-row {
    grid-template-columns: 1fr;
  }

  #toggleFieldFilterBtn {
    width: 100%;
  }

  .toolbar-filter-panel {
    padding: 10px 12px;
  }

  .action-log-head {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .action-log-head .btn {
    width: 100%;
  }

  .action-log-list {
    padding: 4px 12px 10px;
  }

  .action-log-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .table-wrap {
    min-height: 32vh;
    max-height: 58vh;
  }

  thead th,
  tbody td {
    white-space: nowrap;
  }

  .site-footer {
    line-height: 1.7;
  }
}
