:root {
  --page: #f2f4f3;
  --surface: #ffffff;
  --surface-muted: #e8eeec;
  --line: #d5dedb;
  --line-strong: #b6c5c0;
  --ink: #17211f;
  --muted: #63716d;
  --forest-950: #102e28;
  --forest-900: #173d35;
  --forest-700: #176c5b;
  --forest-100: #dceee8;
  --steel-700: #416f7c;
  --steel-100: #dfebee;
  --amber-800: #875709;
  --amber-500: #d59a2a;
  --amber-100: #fff2d4;
  --coral-800: #8e332d;
  --coral-600: #b84c43;
  --coral-100: #fbe5e2;
  --shadow: 0 10px 30px rgba(20, 52, 45, 0.08);
  --radius-sm: 4px;
  --radius-md: 6px;
  --content-width: 1220px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(65, 111, 124, 0.32);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  color: #ffffff;
  background: var(--forest-900);
  border-bottom: 4px solid var(--forest-700);
}

.header-inner {
  width: min(100% - 40px, var(--content-width));
  min-height: 78px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  color: var(--forest-950);
  background: #d6eee6;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-sm);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-family: "STZhongsong", "SimSun", "Microsoft YaHei UI", sans-serif;
  font-size: 21px;
  font-weight: 700;
}

.brand p {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
}

.file-context,
.file-summary {
  display: flex;
  align-items: center;
}

.file-context {
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.file-summary {
  min-width: 0;
  gap: 9px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius-sm);
}

.file-summary svg {
  width: 18px;
  flex: 0 0 18px;
  color: #b9ddd2;
}

.file-summary span {
  display: grid;
  min-width: 0;
}

.file-summary strong,
.file-summary small {
  max-width: 330px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-summary strong {
  font-size: 13px;
}

.file-summary small {
  color: rgba(255, 255, 255, 0.66);
  font-size: 11px;
}

.app-main {
  width: min(100% - 40px, var(--content-width));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.import-section {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 30px;
  align-items: center;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.section-kicker {
  margin: 0 0 5px;
  color: var(--forest-700);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.import-heading h2,
.results-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.drop-zone {
  min-height: 116px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 20px;
  cursor: pointer;
  background: #f9fbfa;
  border: 1px dashed #7ca89c;
  border-radius: var(--radius-md);
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  background: var(--forest-100);
  border-color: var(--forest-700);
  box-shadow: inset 0 0 0 1px var(--forest-700);
}

.drop-icon,
.metric-icon {
  display: grid;
  place-items: center;
}

.drop-icon {
  width: 46px;
  height: 46px;
  color: var(--forest-700);
  background: var(--forest-100);
  border-radius: var(--radius-sm);
}

.drop-icon svg {
  width: 25px;
  height: 25px;
}

.drop-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.drop-copy strong {
  font-size: 15px;
}

.drop-copy small {
  color: var(--muted);
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.button {
  min-height: 40px;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 700;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  color: #ffffff;
  background: var(--forest-700);
  border-color: var(--forest-700);
}

.button-primary:hover:not(:disabled) {
  background: #12594b;
  border-color: #12594b;
}

.button-secondary {
  color: var(--forest-950);
  background: #ffffff;
  border-color: #ffffff;
}

.button-tertiary {
  color: #344641;
  background: var(--surface-muted);
  border-color: var(--line);
}

.button-compact {
  min-height: 36px;
  padding-inline: 11px;
  font-size: 13px;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
}

.icon-button:hover {
  background: rgba(142, 51, 45, 0.09);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.status-panel,
.alert {
  margin-top: 18px;
  padding: 16px 18px;
  align-items: center;
  gap: 13px;
  border-radius: var(--radius-sm);
}

.status-panel {
  display: flex;
  color: var(--forest-900);
  background: var(--forest-100);
  border: 1px solid #bdd8d0;
}

.status-panel strong,
.status-panel p,
.alert strong,
.alert p {
  margin: 0;
}

.status-panel p,
.alert p {
  margin-top: 2px;
  font-size: 13px;
}

.spinner {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 3px solid rgba(23, 108, 91, 0.22);
  border-top-color: var(--forest-700);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.is-loading .spinner {
  animation-play-state: running;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.alert > svg {
  width: 21px;
  height: 21px;
}

.alert-error {
  color: var(--coral-800);
  background: var(--coral-100);
  border: 1px solid #e8b4af;
}

.workspace {
  margin-top: 22px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--forest-700);
  border-radius: var(--radius-sm);
}

.metric-attendance {
  border-top-color: var(--steel-700);
}

.metric-missing {
  border-top-color: var(--amber-500);
}

.metric-hours {
  border-top-color: var(--forest-900);
}

.metric-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  color: var(--forest-700);
  background: var(--forest-100);
  border-radius: var(--radius-sm);
}

.metric-attendance .metric-icon {
  color: var(--steel-700);
  background: var(--steel-100);
}

.metric-missing .metric-icon {
  color: var(--amber-800);
  background: var(--amber-100);
}

.metric-icon svg {
  width: 20px;
  height: 20px;
}

.metric p,
.metric strong {
  margin: 0;
}

.metric p {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 22px;
  line-height: 1.15;
}

.metric strong small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.metric-hours strong {
  font-size: 18px;
}

.issues-panel {
  margin-top: 14px;
  background: var(--amber-100);
  border: 1px solid #e7c987;
  border-radius: var(--radius-sm);
}

.issues-panel summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 15px;
  cursor: pointer;
  color: var(--amber-800);
}

.issues-panel summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.issues-panel summary svg {
  width: 17px;
  height: 17px;
}

.issues-content {
  padding: 0 15px 14px;
  border-top: 1px solid rgba(135, 87, 9, 0.17);
}

.issues-content p {
  margin: 12px 0 8px;
}

.issues-content ul {
  max-height: 180px;
  margin: 0;
  padding-left: 22px;
  overflow: auto;
}

.issues-content li + li {
  margin-top: 5px;
}

.results-section {
  margin-top: 22px;
  background: var(--surface);
  border-top: 3px solid var(--forest-900);
  box-shadow: var(--shadow);
}

.results-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
}

.tab-bar {
  min-height: 48px;
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 0 20px;
  background: #f8faf9;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.tab-button {
  position: relative;
  min-height: 48px;
  padding: 0 12px;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-weight: 700;
}

.tab-button::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: -1px;
  left: 8px;
  height: 3px;
  background: transparent;
}

.tab-button.is-active {
  color: var(--forest-700);
}

.tab-button.is-active::after {
  background: var(--forest-700);
}

.tab-button span {
  min-width: 22px;
  display: inline-flex;
  justify-content: center;
  margin-left: 4px;
  padding: 2px 6px;
  color: var(--muted);
  background: var(--surface-muted);
  border-radius: 10px;
  font-size: 11px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(130px, 0.8fr) minmax(145px, 0.9fr) auto minmax(90px, auto);
  align-items: end;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.field {
  min-width: 0;
  display: grid;
  gap: 6px;
  color: #344641;
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  height: 40px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.field input {
  padding: 0 11px;
}

.field select {
  padding: 0 32px 0 10px;
}

.input-shell {
  position: relative;
  display: block;
}

.input-shell svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.input-shell input {
  padding-left: 36px;
}

.filter-clear {
  white-space: nowrap;
}

.result-count {
  align-self: center;
  justify-self: end;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.daily-table {
  min-width: 860px;
}

.summary-table {
  min-width: 650px;
}

.data-table th,
.data-table td {
  padding: 13px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #e8edeb;
}

.data-table th {
  color: #31423e;
  background: var(--surface-muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.data-table td {
  height: 49px;
}

.data-table tbody tr:hover {
  background: #f8faf9;
}

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

.data-table td.numeric {
  font-variant-numeric: tabular-nums;
}

.duration-value {
  font-weight: 800;
}

.status-badge {
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-normal {
  color: var(--forest-700);
  background: var(--forest-100);
}

.status-missing {
  color: var(--amber-800);
  background: var(--amber-100);
}

.missing-value {
  color: var(--amber-800);
}

.table-empty {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
}

.table-empty svg {
  width: 28px;
  height: 28px;
}

@media (max-width: 900px) {
  .import-section {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-count {
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .header-inner,
  .app-main {
    width: min(100% - 24px, var(--content-width));
  }

  .header-inner {
    min-height: 72px;
    padding: 10px 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .file-context {
    width: 100%;
    justify-content: space-between;
  }

  .file-summary {
    flex: 1;
  }

  .file-summary strong,
  .file-summary small {
    max-width: 52vw;
  }

  .app-main {
    padding: 20px 0 32px;
  }

  .import-section {
    padding: 20px;
  }

  .drop-zone {
    min-height: 190px;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .metrics {
    gap: 9px;
  }

  .metric {
    min-height: 118px;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .metric strong {
    font-size: 20px;
  }

  .metric-hours strong {
    font-size: 16px;
  }

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

  .results-header .button {
    width: 100%;
  }

  .tab-bar {
    padding-inline: 10px;
  }

  .tab-button {
    flex: 1;
    padding-inline: 6px;
  }

  .filters {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .filter-clear {
    width: 100%;
  }

  .result-count {
    justify-self: start;
  }
}

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