/* SCML Import — the shared frame (reset, header, buttons, small controls, theme toggle) comes from
   common/shell.css; this file only adds the import-specific surfaces: the two-pane stage, the
   recognized-block review with its confidence chips, and the mark/add popups. Token-based and
   theme-aware via common/tokens.css.

   The import app's own vocabulary (--panel/--ink/--muted/--line) is aliased onto the shared tokens so
   the many existing rules keep working; the three confidence colours are import-specific. */
:root {
  --panel: var(--surface);
  --ink: var(--text);
  --muted: var(--text-dim);
  --line: var(--border);
  /* Confidence of a recognized mark: structure (high) · datatype (medium) · intent (low). */
  --high: #2f8f5b;
  --medium: #b8791f;
  --low: #3b6fb0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --high: #4ec38a; --medium: #e0a53a; --low: #6ea8e6; }
}
:root[data-theme="dark"] { --high: #4ec38a; --medium: #e0a53a; --low: #6ea8e6; }

.spacer, .grow { flex: 1; }
/* Inline header control (label + field on one line), unlike the reader's stacked side-panel .ctl. */
.ctl { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--muted); }
select { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .3rem .4rem; font: inherit; background: var(--surface); color: var(--text); }

.stage { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); min-height: 0; }
.pane { background: var(--panel); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
/* Section headers (.pane-label / .pl-title / .view-controls) now come from common/shell.css. */

.review {
  flex: 1; overflow: auto; padding: 1.2rem 1.4rem; line-height: 1.65; font-size: .95rem; outline: none;
}
.review .empty { color: var(--muted); font-style: italic; }

/* Each recognized block leaf. A CSS badge (its type) sits in the left gutter — hoverable and clickable
   via the block's title/data-id, but not part of the text, so selection offsets stay exact. */
.rv-blk {
  position: relative; padding: .1rem .2rem .1rem 2.4rem; margin: .3rem 0;
  white-space: pre-wrap; border-radius: 4px;
}
.rv-blk::before {
  content: attr(data-badge); position: absolute; left: .3rem; top: .35em;
  min-width: 1.5rem; height: 1.1rem; padding: 0 .25rem; box-sizing: border-box;
  font-size: .62rem; font-weight: 700; line-height: 1.1rem; text-align: center;
  color: #fff; background: var(--high); border-radius: 4px; opacity: .55; letter-spacing: .02em;
}
.rv-blk:hover { background: color-mix(in srgb, var(--high) 8%, transparent); cursor: pointer; }
.rv-blk:hover::before { opacity: 1; }
.rv-p { margin: .5rem 0; }
.rv-li { margin: .18rem 0; }
.rv-cell { display: inline-block; }
.rv-h { font-weight: 700; color: var(--text); }
.rv-h1 { font-size: 1.5rem; margin: 1rem 0 .3rem; }
.rv-h2 { font-size: 1.25rem; margin: .9rem 0 .3rem; }
.rv-h3 { font-size: 1.08rem; margin: .8rem 0 .3rem; }
.rv-h4, .rv-h5, .rv-h6 { font-size: 1rem; margin: .7rem 0 .3rem; }
.rv-h::before { top: .5em; }

.chip { border-radius: 3px; padding: 0 .1em; cursor: pointer; border-bottom: 2px solid transparent; }
.chip.conf-high { background: color-mix(in srgb, var(--high) 14%, transparent); border-bottom-color: var(--high); }
.chip.conf-medium { background: color-mix(in srgb, var(--medium) 16%, transparent); border-bottom-color: var(--medium); }
.chip.conf-low { background: color-mix(in srgb, var(--low) 15%, transparent); border-bottom-color: var(--low); }
.chip.st-proposed { border-bottom-style: dashed; }
.chip:hover { filter: brightness(.97); box-shadow: 0 0 0 2px rgba(0, 0, 0, .06); }

.legend { display: flex; gap: 1rem; padding: .45rem .8rem; border-top: 1px solid var(--line); font-size: .74rem; }
.chip-legend { padding-left: 1.1rem; position: relative; color: var(--muted); }
.chip-legend::before { content: ""; position: absolute; left: 0; top: .15em; width: .8rem; height: .8rem; border-radius: 3px; }
.chip-legend.high::before { background: color-mix(in srgb, var(--high) 32%, transparent); }
.chip-legend.medium::before { background: color-mix(in srgb, var(--medium) 36%, transparent); }
.chip-legend.low::before { background: color-mix(in srgb, var(--low) 34%, transparent); }

.preview { flex: 1; border: 0; width: 100%; background: var(--surface); }

.menu, .addbar {
  position: fixed; z-index: 20; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: .5rem; font-size: .82rem;
}
.menu-info { color: var(--muted); margin-bottom: .4rem; max-width: 22rem; }
.menu-row { display: flex; align-items: center; gap: .4rem; margin-top: .3rem; }
.menu-row button, .addbar button {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: .3rem .55rem; cursor: pointer;
}
.menu-row button:hover, .addbar button:hover { border-color: var(--accent); }
.addbar { display: flex; align-items: center; gap: .4rem; }

.paste-area {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 30;
  width: min(680px, 90vw); height: 40vh; padding: 1rem; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); font: .9rem/1.5 monospace;
  background: var(--surface); color: var(--text);
}

@media (max-width: 720px) { .stage { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } }
