:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-elevated: #edf2f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #eef2f6;
  --line: #d7dee8;
  --line-strong: #aeb9c8;
  --text: #101828;
  --muted: #667085;
  --muted-strong: #344054;
  --primary: #12343f;
  --primary-strong: #09252d;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e6f4f1;
  --gold: #b88746;
  --gold-soft: #f7efe5;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --warning: #b54708;
  --success: #067647;
  --success-soft: #dcfce7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 18px 42px rgba(16, 24, 40, 0.12);
  --shadow-focus: 0 0 0 3px rgba(15, 118, 110, 0.14);
  --radius: 8px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(237, 242, 247, 0.92), rgba(246, 248, 251, 0) 260px),
    var(--bg);
  color: var(--text);
  font-family: "Lato", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  resize: vertical;
  min-height: 104px;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

.hidden {
  display: none !important;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup.compact {
  gap: 10px;
}

.brand-symbol {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 10px;
  background:
    linear-gradient(135deg, var(--primary), var(--accent) 72%, var(--gold));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), var(--shadow-sm);
  position: relative;
}

.brand-symbol::before,
.brand-symbol::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
}

.brand-symbol::before {
  top: 13px;
}

.brand-symbol::after {
  top: 22px;
}

.topbar h1,
.panel-head h2,
.filter-section h3 {
  margin: 0;
}

.app-shell {
  width: min(1520px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(215, 222, 232, 0.86);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.topbar-title {
  min-width: 0;
}

.topbar h1 {
  font-size: 22px;
  line-height: 1.25;
}

.topbar p,
.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions,
.search-controls,
.panel-head,
.result-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill,
.user-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted-strong);
  font-size: 13px;
  white-space: nowrap;
}

.status-pill.ok {
  border-color: rgba(6, 118, 71, 0.28);
  background: var(--accent-soft);
  color: var(--success);
}

.status-pill.error,
.tag.review {
  border-color: rgba(180, 35, 24, 0.24);
  background: var(--danger-soft);
  color: var(--danger);
}

.workspace {
  display: grid;
  grid-template-columns: 328px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.filter-panel,
.search-panel,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
}

.filter-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  position: sticky;
  top: 20px;
}

.search-panel {
  min-width: 0;
  padding: 18px;
}

.panel-head {
  justify-content: space-between;
}

.panel-head h2 {
  font-size: 16px;
}

.filter-section {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.filter-section h3 {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.field-grid {
  display: grid;
  gap: 10px;
}

.two-cols {
  grid-template-columns: 1fr 1fr;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 16px;
  row-gap: 12px;
  padding: 4px 4px 20px;
  border-bottom: 1px solid var(--line);
}

.query-box {
  grid-column: 1 / -1;
}

.query-box span {
  color: var(--muted-strong);
  font-size: 13px;
}

.quick-query-list {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 44px;
}

.query-chip {
  min-height: 32px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  background: #fff;
  color: var(--muted-strong);
  padding: 5px 11px;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.query-chip:hover {
  border-color: rgba(15, 118, 110, 0.42);
  background: var(--accent-soft);
  color: var(--accent);
}

.search-controls {
  grid-column: 2;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.search-controls label {
  min-width: 120px;
}

.checkbox-line {
  display: inline-flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.checkbox-line input {
  width: auto;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  min-height: 40px;
  padding: 8px 13px;
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.primary-button {
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 8px 18px rgba(18, 52, 63, 0.18);
}

.primary-button:hover {
  background: linear-gradient(180deg, #164653, var(--primary-strong));
}

.secondary-button {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.secondary-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.text-button {
  background: transparent;
  color: var(--accent);
}

.text-button:hover {
  background: var(--accent-soft);
}

.icon-button {
  width: 40px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--muted-strong);
  font-size: 20px;
  line-height: 1;
}

.result-toolbar {
  justify-content: space-between;
  min-height: 38px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-meta {
  color: var(--muted-strong);
  font-weight: 700;
}

.result-hint {
  color: var(--muted);
  white-space: nowrap;
}

.table-scrollbar-top {
  height: 16px;
  margin-bottom: 6px;
  overflow-x: auto;
  overflow-y: hidden;
}

.table-scrollbar-top,
.table-wrap {
  scrollbar-color: #7f858c #edf1f4;
  scrollbar-width: thin;
}

.table-scrollbar-top::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.table-scrollbar-top::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #edf1f4;
}

.table-scrollbar-top::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #7f858c;
}

.table-scrollbar-track {
  height: 1px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.result-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.pagination-summary {
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 700;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-button {
  min-width: 40px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted-strong);
  padding: 6px 10px;
  font-weight: 700;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.pagination-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface);
}

.pagination-button.active {
  border-color: rgba(15, 118, 110, 0.24);
  background: var(--accent-soft);
  color: var(--accent);
}

.result-table {
  width: 100%;
  min-width: 5200px;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
}

.result-table th,
.result-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.result-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f6f8;
  color: var(--muted-strong);
  font-weight: 800;
  white-space: nowrap;
}

.result-table tr {
  transition: background 160ms ease;
}

.result-table tbody tr:hover {
  background: #f5fbfa;
}

.result-table tr:last-child td {
  border-bottom: 0;
}

.project-name {
  margin-bottom: 6px;
  color: var(--primary);
  font-weight: 800;
}

.summary-cell {
  width: 360px;
  color: #344054;
}

.col-year,
.col-number,
.col-date,
.col-bool {
  width: 96px;
}

.col-code {
  width: 160px;
}

.col-file,
.col-path {
  width: 330px;
}

.col-client,
.col-project,
.col-long {
  width: 280px;
}

.col-text,
.col-tags {
  width: 180px;
}

.col-amount {
  width: 130px;
}

.col-id {
  width: 210px;
}

.col-action {
  width: 96px;
}

.result-table td.col-action,
.result-table th.col-action {
  white-space: nowrap;
}

.empty-cell {
  height: 150px;
  color: var(--muted);
  text-align: center !important;
  vertical-align: middle !important;
}

.admin-panel {
  margin-top: 16px;
  padding: 16px;
}

.admin-subhead {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.admin-fold {
  display: block;
}

.admin-fold > summary,
.upload-job > summary {
  cursor: pointer;
  list-style: none;
}

.admin-fold > summary::-webkit-details-marker,
.upload-job > summary::-webkit-details-marker {
  display: none;
}

.admin-fold > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fold-indicator {
  min-width: 54px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.admin-fold[open] .fold-indicator {
  color: var(--accent);
}

.admin-fold[open] .fold-indicator::before {
  content: "收起";
}

.admin-fold[open] .fold-indicator {
  font-size: 0;
}

.admin-fold[open] .fold-indicator::before {
  font-size: 13px;
}

.fold-body {
  margin-top: 12px;
}

.compact-head {
  justify-content: flex-end;
}

.user-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 140px auto;
  gap: 10px;
  margin: 14px 0;
}

.user-list,
.upload-job-list {
  display: grid;
  gap: 8px;
}

.empty-block {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

.upload-job {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #fff;
}

.upload-job-head,
.upload-actions,
.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-job-head {
  justify-content: space-between;
  flex-wrap: wrap;
}

.upload-actions {
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
}

.upload-fold-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.upload-fold-indicator::before {
  content: "展开详情";
}

.upload-job[open] .upload-fold-indicator::before {
  content: "收起详情";
}

.upload-items {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.upload-item {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 90px 120px minmax(160px, 1.3fr);
  border-top: 1px solid var(--line);
  padding-top: 7px;
  color: var(--muted-strong);
  font-size: 13px;
}

.detail-dialog {
  width: min(880px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow-md);
}

.detail-dialog::backdrop {
  background: rgba(15, 23, 42, 0.46);
}

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

.dialog-head h2 {
  margin: 0;
  font-size: 18px;
}

.detail-dialog pre {
  max-height: 70vh;
  margin: 0;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

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

  .search-panel {
    order: 1;
  }

  .filter-panel {
    order: 2;
    position: static;
  }

  .user-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .topbar-actions .secondary-button {
    width: 100%;
  }

  .topbar-actions .secondary-button {
    justify-content: center;
  }

  .two-cols,
  .upload-item {
    grid-template-columns: 1fr;
  }

  .search-controls,
  .result-toolbar,
  .result-actions,
  .result-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-controls {
    justify-content: flex-start;
  }

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

  .query-box,
  .quick-query-list,
  .search-controls {
    grid-column: 1;
  }

  .result-hint {
    white-space: normal;
  }
}
