:root {
  --bg: #f4f7f7;
  --surface: #ffffff;
  --surface-soft: #f8fbfa;
  --text: #14201e;
  --muted: #60706d;
  --line: #d9e3e1;
  --primary: #0f766e;
  --primary-dark: #0a5c56;
  --primary-soft: #e5f5f2;
  --success: #15803d;
  --success-soft: #ecfdf3;
  --warning: #a16207;
  --warning-soft: #fffbeb;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --shadow: 0 18px 48px rgba(17, 50, 45, 0.09);
  --radius: 18px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img, svg { display: block; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(217, 227, 225, 0.85);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}
.header-inner {
  width: min(1180px, calc(100% - 40px));
  min-height: 70px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.github-button,
.primary-button,
.secondary-button,
.ghost-button,
.small-button,
.text-button {
  border-radius: 10px;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.github-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.github-button:hover { border-color: #aabbb8; transform: translateY(-1px); }

.hero {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 70px);
  margin: 0 auto;
  padding: 62px 0 70px;
}
.hero-copy {
  max-width: 820px;
  margin: 0 auto 32px;
  text-align: center;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}
.hero-copy p {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
}
.tool-shell {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.upload-panel { padding: clamp(22px, 5vw, 48px); }
.drop-zone {
  min-height: 330px;
  padding: 38px 24px;
  border: 2px dashed #9eb9b4;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfefd 0%, #f2faf8 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  outline: none;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.drop-zone.dragging { transform: scale(1.005); }
.upload-icon {
  width: 82px;
  height: 82px;
  margin-bottom: 20px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 10px 28px rgba(15, 118, 110, 0.13);
}
.drop-zone h2 { margin-bottom: 6px; font-size: clamp(1.3rem, 3vw, 1.75rem); }
.drop-zone p { margin-bottom: 22px; color: var(--muted); }
.primary-button {
  min-height: 48px;
  padding: 11px 22px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: white;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .2);
}
.primary-button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.file-limit { margin-top: 14px; color: var(--muted); font-size: .88rem; }
.upload-actions { display: flex; justify-content: center; margin-top: 14px; }
.text-button { border: 0; background: transparent; color: var(--primary); font-weight: 750; padding: 8px 12px; }
.text-button:hover { background: var(--primary-soft); }
.inline-message {
  margin-top: 16px;
  padding: 13px 15px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 650;
}
.inline-message.loading { border-color: #bfdbfe; background: var(--info-soft); color: #1d4ed8; }

.result-panel { min-height: 620px; }
.result-toolbar {
  min-height: 84px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.document-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.status-dot { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px var(--success-soft); }
.eyebrow { margin-bottom: 1px; color: var(--primary); font-size: .76rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.document-heading h2 { margin-bottom: 0; font-size: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar-actions { display: flex; gap: 9px; flex: 0 0 auto; }
.secondary-button,
.ghost-button,
.small-button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 750;
}
.secondary-button { display: inline-flex; align-items: center; gap: 8px; border-color: var(--primary); color: var(--primary); }
.secondary-button:hover { background: var(--primary-soft); }
.ghost-button:hover, .small-button:hover { border-color: #9fb2ae; background: var(--surface-soft); }
.result-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 535px; }
.file-summary { padding: 22px; border-right: 1px solid var(--line); background: var(--surface-soft); }
.summary-card { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.file-symbol { width: 50px; height: 50px; flex: 0 0 auto; border-radius: 13px; display: grid; place-items: center; background: var(--primary); color: white; font-size: .72rem; font-weight: 900; letter-spacing: .05em; }
.file-identity { min-width: 0; }
.file-identity strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .94rem; }
.file-identity span { color: var(--muted); font-size: .82rem; }
.metadata-list { margin: 20px 0 0; }
.metadata-list div { padding: 9px 0; border-bottom: 1px solid #e7eeec; }
.metadata-list dt { color: var(--muted); font-size: .75rem; }
.metadata-list dd { margin: 2px 0 0; overflow-wrap: anywhere; font-size: .9rem; font-weight: 700; }
.summary-status { margin-top: 18px; padding: 12px; border-radius: 11px; background: var(--success-soft); color: var(--success); font-size: .84rem; font-weight: 750; }
.summary-status.has-error { background: var(--danger-soft); color: var(--danger); }
.summary-status.has-warning { background: var(--warning-soft); color: var(--warning); }
.content-workspace { min-width: 0; }
.tabs { min-height: 57px; padding: 0 20px; border-bottom: 1px solid var(--line); display: flex; align-items: stretch; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.tab-button { position: relative; min-width: max-content; padding: 0 13px; border: 0; background: transparent; color: var(--muted); font-weight: 750; }
.tab-button::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: transparent; }
.tab-button.active { color: var(--primary); }
.tab-button.active::after { background: var(--primary); }
.tab-count { min-width: 21px; height: 21px; margin-left: 3px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: #eef3f2; font-size: .72rem; }
.tab-panel { padding: clamp(18px, 3vw, 28px); }
.overview-header { margin-bottom: 22px; }
.overview-header h3 { margin-bottom: 4px; font-size: 1.35rem; }
.overview-header p { color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric-card { padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.metric-card span { display: block; margin-bottom: 5px; color: var(--muted); font-size: .78rem; }
.metric-card strong { display: block; overflow-wrap: anywhere; font-size: 1.06rem; }
.party-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.info-card { padding: 17px; border: 1px solid var(--line); border-radius: 13px; }
.info-card h4 { margin: 0 0 11px; font-size: .82rem; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; }
.info-card p { margin: 3px 0; font-size: .9rem; overflow-wrap: anywhere; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 10px; }
.section-heading h3 { margin: 0; font-size: 1.05rem; }
.section-heading span { color: var(--muted); font-size: .8rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-soft); color: var(--muted); font-size: .73rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
td.numeric { text-align: right; white-space: nowrap; }
.empty-state { padding: 28px; border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); text-align: center; }
.findings-list { display: grid; gap: 11px; }
.finding { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; }
.finding-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; }
.finding h3 { margin-bottom: 3px; font-size: .97rem; }
.finding p { margin-bottom: 0; color: var(--muted); font-size: .87rem; }
.finding code { display: inline-block; margin-top: 6px; color: inherit; overflow-wrap: anywhere; }
.finding.success { border-color: #bbf7d0; background: var(--success-soft); }
.finding.success .finding-icon { background: #dcfce7; color: var(--success); }
.finding.warning { border-color: #fde68a; background: var(--warning-soft); }
.finding.warning .finding-icon { background: #fef3c7; color: var(--warning); }
.finding.error { border-color: #fecaca; background: var(--danger-soft); }
.finding.error .finding-icon { background: #fee2e2; color: var(--danger); }
.finding.info { border-color: #bfdbfe; background: var(--info-soft); }
.finding.info .finding-icon { background: #dbeafe; color: var(--info); }
.xml-tree-panel { max-height: 650px; overflow: auto; background: #fbfcfc; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.xml-tree, .xml-tree ul { list-style: none; margin: 0; padding-left: 18px; }
.xml-tree { padding-left: 0; }
.xml-node { padding: 2px 0; }
.xml-node summary { cursor: pointer; }
.xml-tag { color: #075985; }
.xml-attribute { color: #9333ea; }
.xml-value { color: #b45309; }
.xml-text { color: #166534; white-space: pre-wrap; overflow-wrap: anywhere; }
.xml-muted, .tree-limit { color: var(--muted); }
.raw-panel { padding: 0; }
.code-toolbar { min-height: 50px; padding: 8px 14px; border-bottom: 1px solid #27313a; display: flex; align-items: center; justify-content: space-between; background: #152029; color: #d8e1e8; font-size: .8rem; }
.code-toolbar .small-button { min-height: 34px; padding: 5px 10px; border-color: #45525c; background: transparent; color: white; }
.raw-panel pre { max-height: 650px; margin: 0; padding: 20px; overflow: auto; background: #0f1720; color: #d8e1e8; font: .82rem/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; }

.content-section { padding: 80px 20px; background: var(--surface); }
.muted-section { background: #edf4f2; }
.content-grid { width: min(1000px, 100%); margin: 0 auto; display: grid; grid-template-columns: .8fr 1.2fr; gap: 70px; }
.section-kicker { margin-bottom: 8px; color: var(--primary); font-size: .78rem; font-weight: 850; text-transform: uppercase; letter-spacing: .1em; }
.content-section h2 { font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.18; letter-spacing: -.035em; }
.steps-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 22px; }
.steps-list li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; }
.steps-list li > span { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 900; }
.steps-list strong { display: block; margin-bottom: 3px; }
.steps-list p { margin-bottom: 0; color: var(--muted); }
.narrow-content { width: min(760px, 100%); margin: 0 auto; }
.narrow-content > p:last-child { margin-bottom: 0; color: var(--muted); font-size: 1.03rem; }
.faq-section details { border-top: 1px solid var(--line); }
.faq-section details:last-child { border-bottom: 1px solid var(--line); }
.faq-section summary { padding: 18px 0; cursor: pointer; font-weight: 800; }
.faq-section details p { padding: 0 0 18px; color: var(--muted); }
footer { padding: 26px 20px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); text-align: center; font-size: .88rem; }

[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(15, 118, 110, .28); outline-offset: 3px; }

@media (max-width: 860px) {
  .hero { width: min(100% - 24px, 1180px); padding-top: 38px; }
  .result-toolbar { align-items: flex-start; }
  .result-layout { grid-template-columns: 1fr; }
  .file-summary { border-right: 0; border-bottom: 1px solid var(--line); }
  .metadata-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 15px; }
  .content-grid { grid-template-columns: 1fr; gap: 30px; }
}

@media (max-width: 640px) {
  .header-inner { width: calc(100% - 24px); min-height: 62px; }
  .brand span { font-size: .92rem; }
  .github-button { padding: 8px 10px; }
  .github-button span { display: none; }
  .hero { min-height: auto; padding: 32px 0 50px; }
  .hero-copy { margin-bottom: 24px; }
  .tool-shell { border-radius: 18px; }
  .upload-panel { padding: 12px; }
  .drop-zone { min-height: 320px; padding: 28px 18px; }
  .result-toolbar { padding: 16px; flex-direction: column; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions button { flex: 1; justify-content: center; }
  .file-summary { padding: 16px; }
  .metadata-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs { padding: 0 8px; }
  .tab-panel { padding: 17px 14px; }
  .metric-grid, .party-grid { grid-template-columns: 1fr; }
  .content-section { padding: 60px 20px; }
}

@media print {
  :root { --line: #c9c9c9; }
  body { background: white; color: black; }
  .site-header, .hero-copy, .upload-panel, .toolbar-actions, .tabs, .content-section, footer, .file-summary, #validationTab, #treeTab, #rawTab { display: none !important; }
  .hero { width: 100%; min-height: auto; padding: 0; }
  .tool-shell, .result-panel { border: 0; border-radius: 0; box-shadow: none; }
  .result-toolbar { padding: 0 0 18px; border-bottom: 2px solid black; }
  .result-layout { display: block; min-height: 0; }
  .content-workspace { width: 100%; }
  #overviewTab { display: block !important; padding: 20px 0; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .table-wrap { overflow: visible; }
  table { font-size: 10pt; }
  tr { break-inside: avoid; }
}
