:root {
  color-scheme: light;
  --ink: #182027;
  --muted: #61707f;
  --line: #d7dee5;
  --paper: #f7f9fb;
  --panel: #ffffff;
  --accent: #146c63;
  --accent-2: #9f5b22;
  --danger: #b23338;
  --soft: #e8f3f1;
  --shadow: 0 18px 45px rgba(22, 34, 44, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #eef4f7 0%, #f7f9fb 42%, #ffffff 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  padding-bottom: 72px;
}

.loader-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.95) 0 18%, rgba(244, 248, 252, 0) 42%),
    linear-gradient(180deg, #f5f8fb 0%, #eef5f3 100%);
  transition: opacity 320ms ease, visibility 320ms ease;
}

.loader-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loader-card {
  display: grid;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
  font-weight: 700;
  width: min(420px, calc(100vw - 32px));
}

.loader-card p {
  margin: 0;
  text-align: center;
}

.loader-logo-card {
  display: grid;
  place-items: center;
  width: min(240px, 64vw);
  min-height: 120px;
  padding: 16px 26px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 108, 99, 0.13);
}

.loader-logo-card img {
  display: block;
  width: 168px;
  max-width: 100%;
  height: auto;
}

.tile-loader {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  gap: 8px;
  align-items: end;
  justify-content: center;
  min-height: 74px;
  perspective: 520px;
}

.tile-loader span {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 7px;
  border: 2px solid var(--tile-color);
  background: #fff;
  color: var(--tile-color);
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 13px 24px rgba(22, 34, 44, 0.16);
  transform-origin: 50% 100%;
  overflow: hidden;
  animation: tile-loader-bounce 1.28s cubic-bezier(0.22, 0.68, 0.24, 1) infinite;
  animation-delay: var(--delay);
}

.tile-loader span::after {
  content: "";
  position: absolute;
  inset: -18%;
  background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.15) 42%, rgba(255, 255, 255, 0.92) 50%, rgba(255, 255, 255, 0.15) 58%, transparent 80%);
  transform: translateX(-120%) rotate(10deg);
  animation: tile-loader-glint 1.9s ease-in-out infinite;
  animation-delay: calc(var(--delay) + 180ms);
}

.loader-product {
  position: relative;
  margin-top: -6px;
  color: #24313d;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.loader-title {
  color: #06443f;
  font-size: 16px;
  font-weight: 800;
}

.loader-tagline {
  position: relative;
  z-index: 0;
  display: inline-block;
  overflow: hidden;
  padding: 2px 8px;
  color: #24313d;
  font-size: 17px;
  font-weight: 800;
  text-shadow:
    0 0 8px rgba(15, 118, 110, 0.2),
    0 0 18px rgba(219, 39, 119, 0.14);
  animation: tagline-glow 2.6s ease-in-out infinite;
}

.loader-tagline::before {
  content: "";
  position: absolute;
  inset: -30% auto -30% -38%;
  z-index: 1;
  width: 30%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.92) 50%, rgba(255, 255, 255, 0) 100%);
  transform: skewX(-22deg);
  opacity: 0;
  pointer-events: none;
  animation: guide-button-shine 3.2s ease-in-out infinite;
}

.loader-tagline::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(232, 243, 241, 0.58) 100%);
  box-shadow: 0 8px 22px rgba(20, 108, 99, 0.08);
}

.loader-watermark {
  position: absolute;
  left: clamp(14px, 3vw, 34px);
  bottom: clamp(14px, 3vw, 30px);
  display: grid;
  gap: 3px;
  max-width: min(260px, calc(100vw - 28px));
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  color: rgba(36, 49, 61, 0.86);
  box-shadow:
    0 14px 30px rgba(22, 34, 44, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(16px) saturate(145%);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
}

.loader-watermark span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 1px 7px rgba(255, 255, 255, 0.8);
}

.loader-watermark strong {
  color: rgba(24, 32, 39, 0.92);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.82);
}

@keyframes tile-loader-bounce {
  0%,
  70%,
  100% {
    transform: translateY(0) rotateX(0deg);
    box-shadow: 0 13px 24px rgba(22, 34, 44, 0.18);
  }

  28% {
    transform: translateY(-22px) rotateX(18deg);
    box-shadow: 0 24px 30px rgba(22, 34, 44, 0.14);
  }

  46% {
    transform: translateY(3px) rotateX(-10deg);
    box-shadow: 0 9px 18px rgba(22, 34, 44, 0.22);
  }
}

@keyframes tile-loader-glint {
  0%,
  58%,
  100% {
    transform: translateX(-120%) rotate(10deg);
    opacity: 0;
  }

  22%,
  34% {
    transform: translateX(120%) rotate(10deg);
    opacity: 1;
  }
}

@keyframes tagline-glow {
  0%,
  100% {
    text-shadow:
      0 0 8px rgba(15, 118, 110, 0.2),
      0 0 18px rgba(219, 39, 119, 0.14);
  }

  50% {
    text-shadow:
      0 0 12px rgba(15, 118, 110, 0.34),
      0 0 26px rgba(219, 39, 119, 0.22);
  }
}

button,
input,
textarea {
  font: inherit;
}

.app {
  min-height: 100vh;
  padding: 28px 28px 76px;
}

.workspace {
  max-width: 1320px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

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

.brand-logo {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 76px;
  height: 58px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(20, 108, 99, 0.22);
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.loader-logo {
  width: clamp(108px, 28vw, 142px);
  height: clamp(82px, 20vw, 108px);
}

.small-logo {
  width: 68px;
  height: 48px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1;
}

h2 {
  font-size: 18px;
}

.summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary span {
  min-width: 116px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.summary strong {
  display: block;
  color: var(--ink);
  font-size: 24px;
}

.inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.upload-guide {
  margin-bottom: 18px;
}

.guide-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f4fbf8 100%);
  box-shadow: var(--shadow);
  padding: 18px;
}

.guide-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.guide-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.guide-actions .secondary {
  position: relative;
  overflow: hidden;
  border-color: #bfd1de;
  background: linear-gradient(180deg, #ffffff 0%, #eef7fb 100%);
  box-shadow: 0 8px 18px rgba(20, 108, 99, 0.08);
}

.guide-actions .secondary::before {
  content: "";
  position: absolute;
  inset: -20% auto -20% -35%;
  width: 32%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.88) 50%, rgba(255, 255, 255, 0) 100%);
  transform: skewX(-22deg);
  animation: guide-button-shine 3.2s ease-in-out infinite;
  pointer-events: none;
}

.guide-actions .secondary:nth-child(2)::before {
  animation-delay: 1.2s;
}

@keyframes guide-button-shine {
  0%,
  68%,
  100% {
    left: -40%;
    opacity: 0;
  }

  16%,
  28% {
    left: 118%;
    opacity: 1;
  }
}

.guide-notes {
  display: grid;
  gap: 10px;
}

.guide-notes p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.panel,
.table-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel-head,
.result-head,
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  margin: 16px 0 12px;
  border: 1px dashed #9caebb;
  border-radius: 8px;
  background: #f9fbfc;
  color: var(--muted);
  cursor: pointer;
}

.file-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

textarea {
  display: block;
  width: 100%;
  min-height: 210px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fcfdfe;
  line-height: 1.45;
}

textarea:focus,
input:focus,
button:focus-visible {
  outline: 3px solid rgba(20, 108, 99, 0.22);
  outline-offset: 2px;
}

.controls {
  justify-content: flex-start;
  margin: 18px 0;
  padding: 14px 0;
}

.error-strip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
  padding: 13px 15px;
  border: 1px solid #efb3b7;
  border-radius: 8px;
  background: #fff2f3;
  color: #8f2227;
  box-shadow: var(--shadow);
}

.error-strip strong {
  display: block;
  font-size: 14px;
}

.error-strip ul {
  display: grid;
  gap: 5px;
  margin: 7px 0 0;
  padding-left: 18px;
}

.error-strip li {
  font-size: 14px;
  line-height: 1.35;
}

.is-hidden {
  display: none !important;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

input[type="number"] {
  width: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  filter: brightness(0.96);
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  padding: 0 12px;
}

.results {
  display: grid;
  gap: 18px;
}

.table-block {
  overflow: hidden;
}

.result-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

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

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 850px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: var(--soft);
  color: #26413f;
  font-size: 12px;
  text-transform: uppercase;
}

td.amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reason {
  display: inline-block;
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff3e5;
  color: var(--accent-2);
  font-weight: 700;
  white-space: nowrap;
}

.reason.high {
  background: #fbe8ea;
  color: var(--danger);
}

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

.captcha-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 26px 70px rgba(22, 34, 44, 0.28);
}

.captcha-dialog::backdrop {
  background: rgba(24, 32, 39, 0.42);
}

.captcha-box {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.captcha-box h2,
.captcha-box p {
  margin: 0;
}

.captcha-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.captcha-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  padding: 8px 18px;
  border-top: 1px solid rgba(215, 222, 229, 0.84);
  background: rgba(255, 255, 255, 0.82);
  color: #1e3946;
  box-shadow: 0 -14px 36px rgba(22, 34, 44, 0.08);
  backdrop-filter: blur(14px) saturate(145%);
  -webkit-backdrop-filter: blur(14px) saturate(145%);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 18px;
  width: min(1320px, 100%);
  min-height: 48px;
  margin: 0 auto;
}

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

.footer-brand img {
  width: 38px;
  height: 30px;
  border-radius: 6px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 18px rgba(20, 108, 99, 0.12);
}

.footer-brand div {
  display: grid;
  gap: 1px;
}

.footer-brand strong {
  color: #173d4f;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.05;
}

.footer-brand span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.footer-credit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(215, 222, 229, 0.8);
  border-radius: 999px;
  background: rgba(247, 249, 251, 0.72);
  color: #173d4f;
  font-size: 12px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  white-space: nowrap;
}

.app-footer p {
  justify-self: end;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.beat-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 2px;
  vertical-align: middle;
}

.beat-dots i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: footer-dot-beat 1s infinite ease-in-out;
}

.beat-dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.beat-dots i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes footer-dot-beat {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  40% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

@media (max-width: 820px) {
  .app {
    padding: 16px 16px 110px;
  }

  .topbar,
  .inputs {
    display: block;
  }

  .brand {
    align-items: flex-start;
  }

  .summary {
    justify-content: flex-start;
    margin-top: 16px;
  }

  .panel + .panel {
    margin-top: 16px;
  }

  .controls {
    flex-wrap: wrap;
  }

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

  .result-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .guide-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  body {
    padding-bottom: 106px;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 8px;
    justify-items: center;
    min-height: 88px;
  }

  .footer-brand {
    justify-content: center;
  }

  .footer-credit {
    min-height: 30px;
  }

  .app-footer p {
    justify-self: center;
    text-align: center;
  }
}

@media (max-width: 430px) {
  .brand-logo {
    width: 64px;
    height: 50px;
  }

  .tile-loader {
    grid-template-columns: repeat(3, 40px);
    gap: 7px;
    min-height: 64px;
  }

  .tile-loader span {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .app-footer {
    padding: 8px 12px;
  }

  .footer-credit {
    width: 100%;
    white-space: normal;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile-loader span,
  .tile-loader span::after,
  .loader-tagline,
  .loader-tagline::before,
  .loader-tagline::after {
    animation: none;
  }

  .loader-tagline::before,
  .loader-tagline::after {
    opacity: 0;
  }
}
