/* Data Extractor — tables out of documents, on top of the site stylesheet. */

/* .btn sets display, which would otherwise override the hidden attribute */
[hidden] { display: none !important; }

.tool-hero { padding-block: 3.5rem 1.75rem; }
.tool-hero h1 { margin-bottom: .3em; }
.tool-hero .lead { max-width: 62ch; margin: 0; }
.tool { padding-bottom: 4.5rem; }
.tool .container { display: grid; gap: 1.25rem; }

.hint { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-3); margin: 0; }
.text-link-sm { font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: .18em; }
.text-link-sm:hover { color: var(--accent-ink); }

/* ---------- source card ---------- */
.source {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: grid; gap: 1rem;
}
.tabs {
  display: inline-grid; grid-auto-flow: column; gap: 3px; justify-self: start;
  padding: 3px; border-radius: 11px; background: var(--surface-2);
}
.tabs button {
  border: 0; background: transparent; cursor: pointer;
  padding: .5rem 1rem; border-radius: 8px;
  font-weight: 600; font-size: .9rem; color: var(--ink-2);
  transition: background-color .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(22, 26, 27, .08), inset 0 0 0 1px var(--line); }
.pane { display: grid; gap: .75rem; }

.drop {
  display: grid; justify-items: center; gap: .45rem; text-align: center;
  padding: 2.4rem 1.25rem;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  transition: border-color .18s var(--ease), background-color .18s var(--ease);
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-tint-2); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.drop-icon { width: 34px; height: 34px; color: var(--accent); stroke-width: 1.6; margin-bottom: .25rem; }
.drop-title { font-weight: 600; font-size: 1.05rem; }
.drop-title u { text-decoration-color: var(--accent); text-underline-offset: .2em; }
.drop-formats { font-size: .78rem; color: var(--ink-3); }

#text {
  width: 100%; min-height: 11rem; resize: vertical;
  font: inherit; font-size: .95rem; line-height: 1.55; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .75rem .85rem;
}
#text:focus, .fname input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.pane-foot { display: flex; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; }

.status { margin: 0; font-size: .9rem; color: var(--ink-2); }
.status:empty { display: none; }
.status.err { color: var(--danger); }
.status.busy::before {
  content: ""; display: inline-block; width: .8em; height: .8em; margin-right: .5em; vertical-align: -.08em;
  border: 2px solid var(--accent-tint); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- result ---------- */
.result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: grid; gap: 1rem; min-width: 0;
}
.result-head { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem 1.5rem; flex-wrap: wrap; }
.result-source { margin: 0 0 .2rem; font-size: .76rem; color: var(--ink-3); word-break: break-all; }
.result-title { font-size: 1.35rem; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips button {
  border: 1px solid var(--line); background: var(--paper); cursor: pointer;
  padding: .4rem .75rem; border-radius: 999px;
  font-size: .82rem; font-weight: 600; color: var(--ink-2);
  transition: border-color .18s var(--ease), background-color .18s var(--ease), color .18s var(--ease);
}
.chips button span { font-family: var(--font-mono); font-weight: 400; color: var(--ink-3); margin-left: .35em; }
.chips button:hover { border-color: var(--ink-3); color: var(--ink); }
.chips button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips button[aria-selected="true"] span { color: rgba(255, 255, 255, .75); }

.options { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.4rem; padding-block: .1rem; }
.check { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); margin: 0; }

.grid-wrap {
  overflow: auto; max-height: 30rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.grid { border-collapse: separate; border-spacing: 0; font-size: .86rem; min-width: 100%; }
.grid th, .grid td {
  padding: .5rem .7rem; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  max-width: 22rem; overflow-wrap: anywhere;
}
.grid tr > :last-child { border-right: 0; }
.grid thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); font-weight: 600; color: var(--ink);
  white-space: nowrap;
}
.grid .rownum { width: 1%; white-space: nowrap; color: var(--ink-3); font-family: var(--font-mono); font-size: .72rem; text-align: right; background: var(--paper); position: sticky; left: 0; z-index: 1; }
.grid thead .rownum { z-index: 3; }
.col-head { display: flex; align-items: center; gap: .35rem; }
.col-name { outline: none; border-radius: 4px; padding: .05rem .2rem; margin: -.05rem -.2rem; min-width: 1.5rem; }
.col-name:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.col-del {
  border: 0; background: transparent; cursor: pointer; flex: none;
  width: 1.3rem; height: 1.3rem; border-radius: 5px; display: grid; place-items: center;
  color: var(--ink-3); font-size: 1rem; line-height: 1;
}
.col-del:hover { background: var(--danger); color: #fff; }
.grid tbody tr:hover td { background: var(--accent-tint-2); }
.grid-note { margin-top: -.4rem; }

.export { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; padding-top: .25rem; }
.fname { display: grid; gap: .35rem; }
.fname span { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.fname input {
  width: 14rem; font: inherit; font-size: .92rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .55rem .7rem;
}
.export-btns { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- how it works & FAQ ---------- */
.how { padding-block: 4.5rem 4rem; border-top: 1px solid var(--line); }
.how-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.how-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem 1.4rem; }
.how-num { display: block; color: var(--accent); font-size: .85rem; margin-bottom: .9rem; }
.how-list h3 { margin-bottom: .45rem; }
.how-list p { margin: 0; color: var(--ink-2); font-size: .95rem; }

.faq-wrap { padding-block: 1rem 5rem; }
.faq { max-width: 46rem; display: grid; gap: .7rem; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 1.2rem; }
.faq summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; font-weight: 600; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-mono); color: var(--ink-3); font-size: 1.1rem; transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 1.1rem; color: var(--ink-2); }

@media (max-width: 860px) {
  .how-list { grid-template-columns: 1fr; }
  .export { flex-direction: column; align-items: stretch; }
  .fname input { width: 100%; }
}
