/* The lexicon dialog (js/lexicon.js). */

dialog.lex-dlg {
  height: min(760px, calc(100vh - 32px));
}
.lex-dlg .dlg-body { display: flex; flex-direction: column; overflow: hidden; }
.lex-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.lex-error {
  padding: 6px 14px;
  background: var(--error-bg);
  border-bottom: 1px solid var(--error-border);
  color: var(--error);
  font-size: var(--font-size-sm);
}

.lex-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
}
.lex-col {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}
.lex-left { border-right: 1px solid var(--border-subtle); }
.lex-right { background: var(--bg-surface); }

.lex-pane { padding: 12px 14px; overflow: auto; min-height: 0; }
.lex-pane + .lex-pane { border-top: 1px solid var(--border-subtle); }
.lex-chosen { max-height: 45vh; }

.lex-pane h4 {
  margin: 0 0 8px;
  font-size: var(--font-size-base);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.lex-pane h4 small { font-weight: 400; color: var(--text-muted); font-size: var(--font-size-sm); }
.lex-note { margin: 8px 0 0; }
.lex-picker { display: inline-flex; align-items: baseline; gap: 8px; font-weight: 400; }

/* Results being fetched stay visible, dimmed, until the newest ones arrive. */
.lex-busy { opacity: 0.55; transition: opacity 0.15s; }

/* ---- Chosen words ---- */

.lex-chosen.drop { outline: 2px dashed var(--border-focus); outline-offset: -4px; background: var(--accent-muted); }
.lex-chips { display: flex; flex-wrap: wrap; gap: 6px 4px; }
.lex-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--accent);
  background: var(--accent-muted);
  border-radius: var(--radius-xl);
  padding: 2px 4px 2px 9px;
  font-size: var(--font-size-base);
}
.lex-chip small { color: var(--text-secondary); font-size: var(--font-size-sm); font-variant-numeric: tabular-nums; }
.lex-chip.miss { border-color: var(--error-border); background: var(--error-bg); }
.lex-chip.miss small { color: var(--error); }
.lex-x {
  font: inherit;
  font-size: var(--font-size-sm);
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  border-radius: var(--radius-sm);
}
.lex-x:hover { color: var(--text-primary); background: var(--bg-hover); }
.lex-add { margin-top: 8px; }
.lex-input { width: 240px; max-width: 100%; }

/* ---- Suggestions ---- */

.lex-sug-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  margin-bottom: 5px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}
.lex-sug-row:hover { background: var(--bg-hover); }
.lex-sug-row.drag { opacity: 0.55; border-style: dashed; }
.lex-box {
  width: 20px;
  height: 20px;
  flex: none;
  padding: 0;
  border: 1.5px solid var(--text-muted);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
}
.lex-box:hover { border-color: var(--accent); background: var(--accent-muted); }
.lex-box:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.lex-sug-row .lex-word { font-weight: 600; min-width: 96px; }
.lex-meta { color: var(--text-secondary); font-size: var(--font-size-sm); flex: 1; }
.lex-n { color: var(--text-secondary); font-size: var(--font-size-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lex-grip { color: var(--text-muted); letter-spacing: -2px; cursor: grab; padding: 0 4px; user-select: none; }
.lex-grip:active { cursor: grabbing; }

/* ---- Coverage ---- */

.lex-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.lex-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 9px;
}
.lex-v { font-size: var(--font-size-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.lex-k { font-size: var(--font-size-sm); color: var(--text-secondary); }

.lex-table { border-collapse: collapse; width: 100%; font-size: var(--font-size-sm); background: var(--bg-card); }
.lex-table th, .lex-table td {
  padding: 3px 7px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lex-table th:first-child, .lex-table td:first-child { text-align: left; white-space: normal; }
.lex-table th { color: var(--text-secondary); font-weight: 500; }
.lex-bar { display: inline-block; height: 8px; background: var(--accent); border-radius: 2px; vertical-align: middle; }
.lex-pen { color: var(--error); }
.lex-zero { color: var(--error); font-weight: 600; }

.lex-foot-note { margin-right: auto; }

@media (max-width: 720px) {
  .lex-dlg .dlg-body { overflow: auto; }
  .lex-grid { grid-template-columns: 1fr; }
  .lex-col { grid-template-rows: auto auto; }
  .lex-left { border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .lex-kpis { grid-template-columns: 1fr; }
}
