:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d212b;
  --line: #2a2f3a;
  --ink: #eef1f6;
  --muted: #99a1b3;
  --accent: #6ee7b7;
  --accent-2: #38bdf8;
  --danger: #fb7185;
  --warning: #fbbf24;
  --info: #7dd3fc;
  --radius: 16px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(56, 189, 248, 0.12), transparent 60%),
    radial-gradient(900px 500px at 5% 0%, rgba(110, 231, 183, 0.1), transparent 55%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.55;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 20px 100px;
}

.hero { text-align: center; margin-bottom: 36px; }

.badge {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(110, 231, 183, 0.08);
  border: 1px solid rgba(110, 231, 183, 0.25);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

h1 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: clamp(38px, 7vw, 60px);
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}
.amp { color: var(--accent-2); padding: 0 2px; }

.tagline {
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto;
  font-size: 16px;
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 34px 20px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
  text-align: center;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent-2); background: rgba(56, 189, 248, 0.05); outline: none; }
.dropzone.drag { border-color: var(--accent); background: rgba(110, 231, 183, 0.07); }
.up-icon { width: 30px; height: 30px; fill: none; stroke: var(--accent-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }
.drop-title { font-weight: 600; }
.drop-sub { color: var(--muted); font-size: 14px; }

.file-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-list li {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--line);
  padding: 9px 12px; border-radius: 10px; font-size: 14px;
}
.file-list .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fsize { color: var(--muted); font-size: 12px; }
.file-list .remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }
.file-list .remove:hover { color: var(--danger); }

.or { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; margin: 20px 0 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.text-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  padding: 14px;
  resize: vertical;
}
.text-input:focus { outline: none; border-color: var(--accent-2); }

.analyze-btn {
  width: 100%;
  margin-top: 18px;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06121a;
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.08s, filter 0.2s;
}
.analyze-btn:hover { filter: brightness(1.06); }
.analyze-btn:active { transform: translateY(1px); }
.analyze-btn:disabled { opacity: 0.6; cursor: progress; }

.disclaimer { color: var(--muted); font-size: 12px; text-align: center; margin: 14px 0 0; }

.status { margin-top: 26px; text-align: center; color: var(--muted); }
.status.error {
  color: var(--danger);
  background: rgba(251, 113, 133, 0.08);
  border: 1px solid rgba(251, 113, 133, 0.3);
  border-radius: 12px;
  padding: 16px;
}
.spinner {
  width: 30px; height: 30px; margin: 0 auto 12px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.results { margin-top: 32px; display: flex; flex-direction: column; gap: 18px; }
.results[hidden] { display: none; }

.r-head { text-align: center; margin-bottom: 4px; }
.doc-type {
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-2); margin-bottom: 8px;
}
.r-summary { font-size: 17px; }

.bottom-line {
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.12), rgba(56, 189, 248, 0.1));
  border: 1px solid rgba(110, 231, 183, 0.3);
}
.bl-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.bl-amount { font-family: "Fraunces", serif; font-size: 34px; margin: 4px 0 8px; }
.bl-exp { color: var(--ink); }

.section-title { font-family: "Fraunces", serif; font-size: 22px; margin: 8px 4px 0; font-weight: 600; }

.breakdown { display: flex; flex-direction: column; gap: 0; padding: 6px 0; }
.item { padding: 16px 4px; border-top: 1px solid var(--line); }
.item:first-child { border-top: none; }
.item-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.item-title { font-weight: 600; }
.item-original { color: var(--muted); font-size: 13px; font-family: ui-monospace, monospace; text-align: right; }
.item-plain { margin-top: 6px; color: #d3d8e3; }

.flags { display: flex; flex-direction: column; gap: 12px; }
.flag {
  display: flex; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  background: var(--bg);
}
.flag .dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; }
.flag.danger { border-color: rgba(251, 113, 133, 0.4); }
.flag.danger .dot { background: var(--danger); }
.flag.warning { border-color: rgba(251, 191, 36, 0.35); }
.flag.warning .dot { background: var(--warning); }
.flag.info .dot { background: var(--info); }
.flag-item { font-weight: 600; margin-bottom: 3px; }
.flag-reason { color: #d3d8e3; font-size: 15px; }
.flag-typical { margin-top: 6px; font-size: 13px; color: var(--accent); }

.no-flags { color: var(--accent); text-align: center; padding: 18px; }
