:root {
  --ink: #17211c;
  --ink-strong: #07130f;
  --muted: #66736d;
  --subtle: #8a9690;
  --line: #dfe6e1;
  --line-strong: #c7d4cc;
  --page: #eef3ef;
  --soft: #f6f8f5;
  --panel: #ffffff;
  --panel-2: #fbfcfa;
  --accent: #0b6b57;
  --accent-dark: #064637;
  --accent-soft: #e2f1eb;
  --amber: #b98723;
  --amber-soft: #fff2d6;
  --danger: #b64242;
  --danger-soft: #fff0ee;
  --shadow-soft: 0 10px 28px rgba(17, 35, 27, 0.08);
  --shadow-panel: 0 24px 70px rgba(23, 33, 28, 0.12);
  --glass: rgba(255, 255, 255, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-edge: rgba(255, 255, 255, 0.74);
  --radius: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(11, 107, 87, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(11, 107, 87, 0.05) 1px, transparent 1px),
    linear-gradient(120deg, rgba(255, 242, 214, 0.48), transparent 34%, rgba(226, 241, 235, 0.58) 72%, transparent),
    var(--page);
  background-size: 42px 42px, 42px 42px, auto, auto;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(115deg, transparent 0 34%, rgba(255, 255, 255, 0.42) 35%, transparent 42%),
    repeating-linear-gradient(115deg, transparent 0 118px, rgba(11, 107, 87, 0.08) 119px, transparent 121px);
  opacity: 0.72;
  animation: backgroundDrift 18s linear infinite;
}

body::after {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 18%),
    repeating-linear-gradient(90deg, transparent 0 86px, rgba(184, 135, 35, 0.06) 87px, transparent 89px);
  mix-blend-mode: multiply;
  opacity: 0.65;
}

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

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 24px;
  animation: appReveal 620ms cubic-bezier(0.2, 0.78, 0.24, 1) both;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 428px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1500px;
  margin: 0 auto;
}

.control-panel,
.result-panel {
  position: relative;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.62)),
    var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(22px) saturate(1.45);
  -webkit-backdrop-filter: blur(22px) saturate(1.45);
}

.control-panel::before,
.result-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    inset 0 0 0 1px rgba(199, 212, 204, 0.42);
  pointer-events: none;
}

.control-panel {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  overflow: auto;
  padding: 26px;
  animation: panelLift 720ms 90ms cubic-bezier(0.2, 0.78, 0.24, 1) both;
}

.control-panel::-webkit-scrollbar,
.table-shell::-webkit-scrollbar,
.removed-list::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.control-panel::-webkit-scrollbar-thumb,
.table-shell::-webkit-scrollbar-thumb,
.removed-list::-webkit-scrollbar-thumb {
  background: #b6c8bf;
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.result-panel {
  min-width: 0;
  padding: 24px;
  animation: panelLift 720ms 160ms cubic-bezier(0.2, 0.78, 0.24, 1) both;
}

.brand-block {
  position: relative;
  padding: 8px 0 22px;
  border-bottom: 1px solid var(--line);
}

.brand-block::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 54px;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--amber));
  border-radius: 999px;
  animation: accentPulse 2600ms ease-in-out infinite;
}

.eyebrow {
  margin: 16px 0 8px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--ink-strong);
  letter-spacing: 0;
}

h1 {
  max-width: 11em;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.05;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.62);
}

h2 {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 900;
}

.intro {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.panel-section,
.query-form {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.upload-zone {
  position: relative;
  display: grid;
  gap: 9px;
  place-items: center;
  min-height: 166px;
  padding: 22px;
  overflow: hidden;
  border: 1px dashed #8faf9f;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(226, 241, 235, 0.54)),
    var(--panel-2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-align: center;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.upload-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 0 32%, rgba(255, 255, 255, 0.72) 44%, transparent 56% 100%);
  transform: translateX(-120%);
  animation: glassSweep 4600ms ease-in-out infinite;
}

.upload-zone::after {
  content: "";
  position: absolute;
  right: -48px;
  bottom: -58px;
  width: 140px;
  height: 140px;
  border: 1px solid rgba(11, 107, 87, 0.16);
  transform: rotate(18deg);
}

.upload-zone:hover {
  border-color: var(--accent);
  box-shadow: 0 18px 44px rgba(11, 107, 87, 0.16);
  transform: translateY(-2px);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(11, 107, 87, 0.24);
  animation: iconFloat 3200ms ease-in-out infinite;
}

.upload-title {
  font-size: 18px;
  font-weight: 900;
}

.upload-copy {
  max-width: 100%;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
}

.field {
  display: grid;
  gap: 8px;
}

.sheet-field {
  position: relative;
  padding: 14px;
  border: 1px solid rgba(199, 212, 204, 0.7);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(226, 241, 235, 0.48));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  animation: panelLift 520ms cubic-bezier(0.2, 0.78, 0.24, 1) both;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label,
legend {
  color: var(--ink-strong);
  font-weight: 900;
}

textarea,
select,
input[type="text"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

textarea::placeholder {
  color: #9aa6a0;
}

textarea:focus,
select:focus,
input[type="text"]:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 107, 87, 0.12);
}

.period-field {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246, 248, 245, 0.74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.period-field legend {
  padding: 0 6px;
}

.period-field label {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.actions,
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.primary-button,
.secondary-button,
.ghost-button,
.export-button {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button::before,
.export-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 0 30%, rgba(255, 255, 255, 0.32) 45%, transparent 58% 100%);
  transform: translateX(-130%);
  transition: transform 560ms ease;
}

.primary-button,
.export-button {
  color: #fff;
  background: linear-gradient(180deg, #0d765f, var(--accent-dark));
  box-shadow: 0 12px 26px rgba(11, 107, 87, 0.22);
}

.secondary-button,
.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.ghost-button {
  width: 100%;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.export-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.primary-button:hover::before,
.export-button:hover:not(:disabled)::before {
  transform: translateX(130%);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.export-button:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
}

.export-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.toolbar {
  min-height: 58px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.toolbar .eyebrow {
  margin-top: 0;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.status-strip > div {
  position: relative;
  min-height: 98px;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 248, 245, 0.68)),
    var(--glass-strong);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: metricRise 640ms cubic-bezier(0.2, 0.78, 0.24, 1) both;
}

.status-strip > div:nth-child(2) {
  animation-delay: 80ms;
}

.status-strip > div:nth-child(3) {
  animation-delay: 160ms;
}

.status-strip > div::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 38px;
  height: 3px;
  background: var(--accent);
  border-radius: 999px;
  opacity: 0.22;
  animation: metricLine 2600ms ease-in-out infinite;
}

.metric-value {
  display: block;
  color: var(--ink-strong);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-label {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.table-shell {
  position: relative;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 10px 28px rgba(17, 35, 27, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.table-shell::before {
  content: "";
  position: sticky;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
  height: 2px;
  z-index: 3;
  background: linear-gradient(90deg, transparent, rgba(11, 107, 87, 0.72), rgba(184, 135, 35, 0.62), transparent);
  animation: scanRail 3200ms ease-in-out infinite;
}

table {
  width: 100%;
  min-width: 1240px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #23362e;
  background: rgba(238, 246, 242, 0.92);
  border-bottom-color: var(--line-strong);
  font-size: 13px;
  font-weight: 900;
}

td {
  color: #243029;
  font-size: 14px;
}

tbody tr:nth-child(even):not(.empty-row) {
  background: rgba(248, 251, 249, 0.76);
}

tbody tr:hover:not(.empty-row) {
  background: var(--accent-soft);
  transform: translateX(2px);
}

tbody tr:not(.empty-row) {
  animation: rowReveal 360ms ease both;
  transition: background 160ms ease, transform 160ms ease;
}

td:nth-child(7),
td:nth-child(8),
td:nth-child(9),
td:nth-child(10) {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  min-height: 30px;
  padding: 0 10px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(11, 107, 87, 0.18);
}

.empty-row td {
  position: sticky;
  left: 0;
  height: 190px;
  color: var(--muted);
  background:
    linear-gradient(180deg, transparent 0 48%, rgba(11, 107, 87, 0.08) 50%, transparent 53%),
    linear-gradient(90deg, rgba(11, 107, 87, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(11, 107, 87, 0.04) 1px, transparent 1px),
    rgba(255, 255, 255, 0.86);
  background-size: 100% 160px, 30px 30px, 30px 30px, auto;
  animation: emptyScan 3600ms linear infinite;
  text-align: center;
  white-space: normal;
}

.removed-box {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.removed-box summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  color: var(--ink-strong);
  background: rgba(251, 252, 250, 0.76);
  font-weight: 900;
  cursor: pointer;
}

.removed-list {
  max-height: 220px;
  overflow: auto;
  padding: 12px 16px 16px;
  color: var(--muted);
  line-height: 1.8;
}

.note {
  color: var(--danger);
  font-weight: 800;
}

@keyframes appReveal {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes panelLift {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes backgroundDrift {
  from {
    transform: translate3d(-28px, 0, 0);
  }
  to {
    transform: translate3d(28px, 0, 0);
  }
}

@keyframes accentPulse {
  0%,
  100% {
    width: 54px;
    opacity: 0.8;
  }
  50% {
    width: 92px;
    opacity: 1;
  }
}

@keyframes glassSweep {
  0%,
  58% {
    transform: translateX(-120%);
  }
  78%,
  100% {
    transform: translateX(120%);
  }
}

@keyframes iconFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes metricRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes metricLine {
  0%,
  100% {
    transform: scaleX(0.72);
    opacity: 0.18;
  }
  50% {
    transform: scaleX(1.12);
    opacity: 0.36;
  }
}

@keyframes scanRail {
  0%,
  100% {
    opacity: 0.22;
    transform: translateX(-30%);
  }
  50% {
    opacity: 0.76;
    transform: translateX(30%);
  }
}

@keyframes emptyScan {
  from {
    background-position: 0 -160px, 0 0, 0 0, 0 0;
  }
  to {
    background-position: 0 160px, 0 0, 0 0, 0 0;
  }
}

@keyframes rowReveal {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
    height: auto;
  }
}

@media (max-width: 640px) {
  .control-panel,
  .result-panel {
    padding: 18px;
  }

  h1 {
    font-size: 30px;
  }

  .field-grid,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .actions,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .export-button {
    width: 100%;
  }
}

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