:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  color: #16181d;
  background: #f7f7f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #16181d;
  --muted: #70747c;
  --faint: #9da1a8;
  --surface: #ffffff;
  --line: #e5e5e1;
  --line-strong: #d7d8d4;
  --accent: #183153;
  --accent-hover: #0f2747;
  --success: #1f7a4d;
  --danger: #b42318;
  --warning: #9a6700;
}

* { box-sizing: border-box; }

html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -180px, rgba(24,49,83,.055), transparent 430px),
    #f7f7f5;
}

button,
input,
label { font: inherit; }

button,
label.button,
summary { -webkit-tap-highlight-color: transparent; }

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(22,24,29,.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: .98rem;
  font-weight: 690;
  letter-spacing: -.01em;
}

.brand-mark {
  width: 14px;
  height: 18px;
  display: inline-block;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  right: -1.5px;
  top: -1.5px;
  background: #f7f7f5;
  border-left: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
}

.local-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .83rem;
  white-space: nowrap;
}

.local-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(31,122,77,.08);
}

.app-shell {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 74px 0 54px;
}

.intro {
  text-align: center;
  margin-bottom: 34px;
}

.intro h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3.75rem);
  line-height: 1.02;
  font-weight: 650;
  letter-spacing: -.055em;
}

.intro p {
  max-width: 520px;
  margin: 17px auto 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
  letter-spacing: -.01em;
}

.upload-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}

.drop-zone {
  min-height: 310px;
  padding: 54px 28px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  outline: none;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.drop-zone.dragging {
  background: #f4f6f9;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.drop-zone:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px rgba(24,49,83,.10);
}

.upload-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: #f3f5f7;
  border-radius: 15px;
  margin-bottom: 22px;
}
.upload-icon svg { width: 28px; height: 28px; }

.drop-title {
  margin: 0;
  font-size: 1.34rem;
  line-height: 1.25;
  font-weight: 620;
  letter-spacing: -.025em;
}

.drop-subtitle {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: .95rem;
}

.upload-actions {
  margin-top: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: .92rem;
  font-weight: 620;
  letter-spacing: -.005em;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease, transform .15s ease;
}

.button:not(:disabled):active { transform: translateY(1px); }
.button:disabled { opacity: .38; cursor: default; }
.button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(24,49,83,.18);
  outline-offset: 2px;
}

.primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 1px rgba(0,0,0,.06);
}
.primary:not(:disabled):hover { background: var(--accent-hover); }

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

.quiet {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line-strong);
}
.quiet:not(:disabled):hover { color: var(--ink); background: #fafafa; }

.danger {
  color: #fff;
  background: var(--danger);
}

.work-area {
  margin-top: 22px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.work-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.work-head h2 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -.025em;
}

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

.status-card {
  padding: 15px 0 17px;
  border-top: 1px solid var(--line);
}

.status-line {
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}

.progress-value { color: var(--faint); font-variant-numeric: tabular-nums; }

progress {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  margin: 11px 0 0;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #eceeec;
}
progress::-webkit-progress-bar { background: #eceeec; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

.table-wrap {
  overflow: auto;
  max-height: 440px;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  font-size: .9rem;
}

th,
td {
  padding: 13px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #eeeeeb;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .012em;
}

th:first-child,
td:first-child {
  width: 50px;
  color: var(--faint);
}

th:nth-child(3),
td:nth-child(3) { width: 108px; white-space: nowrap; }
th:nth-child(4),
td:nth-child(4) { width: 170px; }
th:nth-child(5),
td:nth-child(5) { display: none; }

td:nth-child(2) {
  max-width: 420px;
  overflow-wrap: anywhere;
  color: #25282e;
}

.status-ok { color: var(--success); font-weight: 620; }
.status-working { color: var(--accent); font-weight: 620; }
.status-error { color: var(--danger); font-weight: 620; }
.status-warning { color: var(--warning); font-weight: 620; }

.info-disclosure {
  width: min(720px, 100%);
  margin: 22px auto 0;
  color: var(--muted);
  font-size: .86rem;
}

.info-disclosure summary {
  width: max-content;
  margin: 0 auto;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--muted);
  list-style: none;
  border-radius: 8px;
  user-select: none;
}
.info-disclosure summary::-webkit-details-marker { display: none; }
.info-disclosure summary::after {
  content: "+";
  display: inline-block;
  width: 16px;
  margin-left: 6px;
  color: var(--faint);
  text-align: center;
}
.info-disclosure[open] summary::after { content: "−"; }
.info-disclosure summary:hover { color: var(--ink); background: rgba(255,255,255,.6); }

.info-content {
  margin-top: 6px;
  padding: 17px 20px;
  background: rgba(255,255,255,.64);
  border: 1px solid var(--line);
  border-radius: 12px;
  line-height: 1.55;
}
.info-content p { margin: 0; }
.info-content p + p { margin-top: 8px; }

.footer {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a0a3a8;
  font-size: .78rem;
  border-top: 1px solid rgba(22,24,29,.06);
}

[hidden] { display: none !important; }

@media (max-width: 720px) {
  .page-shell { width: min(100% - 24px, 1120px); }
  .topbar { height: 66px; }
  .local-note { font-size: .76rem; }
  .app-shell { padding-top: 48px; }
  .intro { margin-bottom: 26px; }
  .intro h1 { letter-spacing: -.045em; }
  .intro p { margin-top: 13px; font-size: .96rem; }
  .upload-card, .work-area { border-radius: 16px; }
  .drop-zone { min-height: 280px; padding: 42px 18px; }
  .work-area { padding: 18px; }
  .work-head { align-items: flex-start; flex-direction: column; gap: 16px; }
  .controls { width: 100%; justify-content: stretch; }
  .controls .button { flex: 1 1 auto; }
  th:first-child, td:first-child { display: none; }
  th:nth-child(3), td:nth-child(3) { display: none; }
  th:nth-child(4), td:nth-child(4) { width: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
