/* Styles for tools2.js: search, lore checks, find and replace, import, TODOs, category templates and the
   embeddable admin panels. Only theme variables are used, so light and dark both follow the app theme. */

.btn[hidden] { display: none; }
.t2-page { min-width: 0; max-width: 100%; }
.t2-page [hidden] { display: none !important; }
.t2-offscreen { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }
.t2-break, .t2-wrap { overflow-wrap: anywhere; word-break: break-word; }
.t2-nowrap { white-space: nowrap; }

/* ---------- form controls (tool pages are not inside .dialog, so they carry their own look) ---------- */
.t2-input {
  font: inherit; font-size: 14px; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box;
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
}
.t2-input:focus { outline: none; border-color: var(--accent); }
.t2-input::placeholder { color: var(--text-faint); }
select.t2-input { width: auto; max-width: 100%; }
.t2-textarea { resize: vertical; line-height: 1.5; }
.t2-days { max-width: 180px; }
.t2-file { font: inherit; font-size: 13px; color: var(--text-dim); max-width: 100%; }
.t2-form { display: flex; flex-direction: column; gap: 14px; margin: 14px 0; max-width: 760px; }
.t2-fieldset { display: flex; flex-direction: column; gap: 6px; }
.t2-form .field-grid, .t2-pane .field-grid { margin: 0; }
.t2-pane { display: flex; flex-direction: column; gap: 14px; margin: 14px 0; max-width: 760px; }
.t2-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.t2-filter .t2-input { width: auto; flex: 0 1 200px; }
.t2-out { margin: 14px 0; }
.t2-bar { margin: 12px 0; }
.t2-list { margin: 8px 0; padding-left: 20px; font-size: 13px; color: var(--text-dim); }
.t2-inline-error { font-size: 12px; }

/* ---------- search ---------- */
.t2-search-form { display: flex; gap: 8px; margin: 14px 0 8px; }
.t2-search-form .t2-search-input { flex: 1 1 auto; font-size: 16px; padding: 10px 12px; }
.t2-tips { margin: 6px 0 12px; }
.t2-tips summary { cursor: pointer; color: var(--text-dim); font-size: 13px; padding: 4px 0; }
.t2-tips code, .t2-table code { font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: 12px; color: var(--accent-bright); }
.t2-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.t2-chip {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; cursor: pointer;
  padding: 4px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-raised); color: var(--text-dim);
}
.t2-chip:hover { border-color: var(--accent); color: var(--text); }
.t2-chip.active { background: var(--accent); border-color: var(--accent); color: #1a1510; font-weight: 700; }
.t2-saved-chip { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-raised); overflow: hidden; }
.t2-saved-run, .t2-saved-del { font: inherit; font-size: 12px; background: none; border: 0; color: var(--text-dim); cursor: pointer; padding: 4px 10px; }
.t2-saved-run { color: var(--text); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t2-saved-run:hover { color: var(--accent-bright); }
.t2-saved-del { border-left: 1px solid var(--border); padding: 4px 9px; }
.t2-saved-del:hover { color: var(--bad); }
.t2-result-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 4px; }
.t2-count { color: var(--text-dim); font-size: 13px; }
.t2-head-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.t2-results { display: flex; flex-direction: column; margin-top: 6px; }
.t2-result { padding: 10px 2px; border-bottom: 1px solid var(--border); }
.t2-result-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.t2-result-link { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.t2-result-snippet { margin-top: 4px; font-size: 13px; color: var(--text-dim); line-height: 1.5; overflow-wrap: anywhere; }
.t2-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.t2-page mark, .t2-table mark {
  background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 2px;
}

/* ---------- checks, cards, empty states ---------- */
.t2-tabs { flex-wrap: wrap; margin: 14px 0 10px; }
.t2-check-body > .muted { margin-bottom: 12px; }
.t2-card {
  padding: 12px 14px; margin: 8px 0; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-panel);
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.t2-card.t2-done { opacity: 0.8; border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.t2-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; overflow-wrap: anywhere; }
.t2-card-text { margin: 0; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.t2-related, .t2-pair { align-items: center; }
.t2-related .connection-chip, .t2-pair .connection-chip { max-width: 100%; text-align: left; }
.t2-create, .t2-created { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.t2-empty { padding: 18px 16px; margin: 14px 0; border: 1px dashed var(--border); border-radius: 10px; text-align: center; background: var(--bg-panel); }
.t2-empty p:first-child { margin: 0 0 4px; font-weight: 700; color: var(--ok); }

/* ---------- tables ---------- */
.t2-table-wrap { max-width: 100%; }
.t2-table td, .t2-table th { vertical-align: top; }
.t2-table td { overflow-wrap: anywhere; }
.t2-col-check { width: 28px; }
.t2-samples { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.t2-sample { font-size: 12px; line-height: 1.5; color: var(--text-dim); }
.t2-sample-field {
  display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 6px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; background: var(--bg-raised); color: var(--text-faint);
}
.t2-sample-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- TODOs ---------- */
.t2-todo { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 6px 0; border-top: 1px solid var(--border); transition: opacity .35s ease; }
.t2-todo-label { align-items: flex-start; flex: 1 1 260px; min-width: 0; }
.t2-todo-label input { margin-top: 3px; }
.t2-todo-text { color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.t2-todo-meta { white-space: nowrap; }
.t2-todo.t2-fade { opacity: 0; }

/* ---------- category templates ---------- */
.t2-schema-body { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; min-width: 0; }
.t2-schema summary .badge { margin-left: 6px; }
.t2-schema .t2-table td:nth-child(1) { min-width: 140px; }
.t2-schema .t2-table td:nth-child(4) { min-width: 160px; }
.t2-schema .t2-table .t2-input { width: 100%; }
.t2-schema .t2-table select.t2-input { width: auto; }

/* ---------- access tokens ---------- */
.t2-newtoken {
  margin: 14px 0; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
  border: 2px solid var(--accent); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-panel));
}
.t2-secret { max-height: none; overflow-x: auto; user-select: all; word-break: break-all; }

@media (max-width: 760px) {
  .t2-search-form { flex-wrap: wrap; }
  .t2-search-form .t2-search-input { flex-basis: 100%; }
  .t2-form, .t2-pane { max-width: 100%; }
  .t2-filter .t2-input { flex: 1 1 140px; }
  .t2-samples { min-width: 180px; }
}
