/* Interpretable AI › Tabular — page styles (2026-09-15). Only app.css tokens;
   the space reuses vision.css's .vision-how, .vision-book, .vision-rule*
   rows and .toward-* hues, and app.css's .card (+ .card.unavailable), the
   .act3-head and button rules, all in the section's own hue (--xai /
   --xai-alt). The chooser list and the model page are the Privacy
   Preserving AI model pages' recipe (owner's correction, 2026-09-15). */

/* ---- the Vision / Tabular toggle (top of both chooser pages): the
   #crypto-toggle pill recipe of app.css, scoped by class, teal, the pill
   riding the host's data-space attribute (set by tabular.js). ---- */
.xai-space-toggle {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; margin: 0 0 1.4rem;
  background: color-mix(in srgb, var(--panel-2) 72%, transparent);
  border: 1px solid var(--line); border-radius: .9rem; max-width: 40rem;
}
.xai-space-toggle .xai-space-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 6px); border-radius: .65rem;
  background: var(--panel); border: 1px solid var(--edge);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--navy) 10%, transparent);
  transition: transform .38s var(--ease-settle);
}
.xai-space-toggle[data-space="tabular"] .xai-space-pill { transform: translateX(calc(100% + 4px)); }
.xai-space-toggle .xai-space-btn {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start;
  background: none; border: 0; margin: 0; border-radius: .65rem;
  padding: .55rem .85rem; text-align: left; color: var(--dim);
  font-size: .95rem; font-weight: 400;
}
.xai-space-toggle .xai-space-btn:hover { filter: none; }
.xai-space-toggle .xai-space-btn:active { transform: none; }
.xai-space-toggle .xai-space-title { font-weight: 700; color: var(--ink); }
.xai-space-toggle .xai-space-sub { font-size: .76rem; margin-top: .05rem; }
.xai-space-toggle .xai-space-btn[aria-pressed="true"] .xai-space-title { color: var(--xai-ink); }

/* ---- chooser: the Models page's act-1 list (app.css .card rows, the
   unavailable card included): ALWAYS one column, as #model-cards. ---- */
#tabular-intro p { max-width: 58rem; line-height: 1.55; }
#tabular-intro p:first-child { font-size: 1.08rem; }
#tabular-plain-note { margin: 1rem 0 1.6rem; }
#tabular-models { display: grid; grid-template-columns: 1fr; gap: .9rem; margin: .5rem 0 1rem; }
#tabular-models .card:focus-visible { outline-color: var(--xai); }

/* ---- model page: the act-3 head (#act3-title / #act3-icon / #model-card
   of app.css, cloned under this page's ids — the name titles the page with
   its icon, the recap card in the flush-panel language, the field search
   right of "Try it yourself"). ---- */
#tabular-model-title { display: flex; align-items: center; gap: .6rem; margin: 0 0 1rem; }
#tabular-model-icon { width: 2.3rem; height: 2.3rem; object-fit: contain; flex: none; }
#tabular-model-card {
  background: var(--panel); border-radius: .8rem; box-shadow: var(--ring);
  padding: 1.1rem 1.3rem 1.2rem; margin: 0 0 1.3rem; max-width: 58rem;
}
#tabular-model-card h3 {
  margin: .95rem 0 .25rem; font-size: .8rem; font-weight: 600;
  color: var(--dim);
}
#tabular-model-card h3:first-child { margin-top: 0; }
#tabular-model-card p { margin: 0; font-size: .92rem; line-height: 1.55; }
#tabular-model-card dl {
  margin: .6rem 0 0; display: grid;
  grid-template-columns: max-content 1fr; gap: .4rem 1.1rem;
}
#tabular-model-card dt {
  font-family: var(--font-data); font-size: .78rem; font-weight: 500;
  white-space: nowrap; padding-top: .15rem;
}
#tabular-model-card dd { margin: 0; color: var(--dim); font-size: .88rem; line-height: 1.5; }
#tabular-field-search { max-width: 15rem; padding: .45rem .7rem; font-size: .85rem; }

/* ---- the rulebook switch (2026-10-01): Interpretable Vision's
   #vision-rulebook row (label, .vision-book buttons with `on`, hint), on the
   model page and under the result's context line. ---- */
#tabular-book, #tabular-result-books {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 1rem;
}
#tabular-book-label { color: var(--dim); font-size: .85rem; font-weight: 600; }
#tabular-books { display: inline-flex; gap: .4rem; }
#tabular-result-books { margin: 0 0 .6rem; }
/* Load an example: app.css's .case-picker row, in this section's teal. */
#tabular-case-picker { --pick: var(--xai); --pick-ink: var(--xai-ink); --pick-dim: var(--xai-dim); }
#tabular-unused-note { margin: 0 0 .6rem; }
#tabular-unused-note:empty { display: none; }

/* ---- the row form: the #row-form recipe of app.css, scoped by class ---- */
.tabular-form {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .8rem;
  margin-bottom: 1rem;
}
.tabular-form label {
  position: relative; /* anchors a name's feature-help tooltip */
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: .3rem; color: var(--dim); font-family: var(--font-data); font-size: .74rem;
}
.tabular-form input, .tabular-form select { max-width: none; height: 2.5rem; }
.tabular-form input.invalid, .tabular-form select.invalid { border-color: var(--err); }
/* A field the active rulebook does not read: greyed out, value kept. */
.tabular-form label.unused { opacity: .42; }
.tabular-form label.unused input, .tabular-form label.unused select { background: var(--panel-2); }
.tabular-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
#tabular-run { background: var(--action); }
#tabular-status { min-height: 1.2rem; color: var(--dim); }

/* ---- result ---- */
#tabular-result-context { font-family: var(--font-data); margin: -.4rem 0 .8rem; }
#tabular-verdict { margin: 1rem 0 1.6rem; }
#tabular-verdict-label {
  font-family: var(--font-data); font-size: 2.2rem; font-weight: 700; line-height: 1.1;
  color: var(--dir, var(--ink)); animation: rise .35s var(--ease-settle) both;
}
#tabular-verdict-prob { margin: .3rem 0 0; color: var(--dim); font-family: var(--font-data); font-size: .85rem; }
/* The gauge: class 0 at the left end, class 1 at the right, the marker at
   the sigmoid of the total (--p, set by tabular.js), in the verdict's hue.
   The tracks are packed (justify-content: start; owner, 2026-10-02): both
   class names sit right at the track's ends, never the left one stretched
   to the column's edge. */
.tabular-gauge {
  display: grid; grid-template-columns: auto minmax(8rem, 22rem) auto; align-items: center;
  justify-content: start;
  gap: .6rem; margin: .8rem 0 0; font-size: .8rem; color: var(--dim);
}
.tabular-gauge-track { position: relative; height: .5rem; border-radius: 3px; background: var(--panel-2); }
.tabular-gauge-track i {
  position: absolute; top: -.25rem; width: 1rem; height: 1rem; border-radius: 50%;
  left: calc(var(--p, 50%) - .5rem); background: var(--dir, var(--dim));
  box-shadow: 0 0 0 2px var(--panel);
  transition: left .35s var(--ease-settle);
}
/* A book with a decision threshold (2026-10-01): a tick where it turns. */
.tabular-gauge-track b {
  position: absolute; top: -.35rem; width: 2px; height: 1.2rem;
  left: calc(var(--t, 50%) - 1px); background: var(--ink);
}
#tabular-bridge-note { margin: .6rem 0 0; }
#tabular-bridge-note:empty { display: none; }
#tabular-legend { display: flex; gap: .6rem; flex-wrap: wrap; margin: .3rem 0 .8rem; }
#tabular-rules { display: grid; gap: .3rem; max-width: 58rem; }
/* A rule line anchors the tooltip of a feature named in it. */
#xai-tabular-result .vision-cond { position: relative; }
#tabular-footer {
  font-family: var(--font-data); font-size: .85rem; color: var(--dim);
  border-top: 1px solid var(--line); padding-top: .7rem; margin: 1rem 0 1.6rem; max-width: 58rem;
}
/* ---- What if? (2026-09-16): the Vision panel's twin under the result.
   vision.css's class-scoped rules (.vision-whatif, -bar, -grid, -out,
   -rule, -actions, -flip, the slider skin, the breakpoints) apply as they
   are; only the id-scoped twins (vision.css #vision-whatif-*) and the
   field rows live here. ---- */
#tabular-whatif-changes { font-family: var(--font-data); font-size: .85rem; color: var(--dim); }
#tabular-whatif-changes.some { color: var(--xai-ink); font-weight: 700; }
#tabular-whatif-reset, #tabular-whatif-apply { padding: .32rem .75rem; font-size: .8rem; }
#tabular-whatif-reset:disabled { opacity: .45; cursor: default; }
#tabular-whatif-apply { background: var(--action); color: var(--btn-ink); border-color: var(--action); margin-top: .5rem; }
#tabular-whatif-verdict { display: flex; flex-direction: column; gap: .15rem; min-height: 3.4rem; }
#tabular-whatif-label { font-family: var(--font-data); font-size: 2rem; font-weight: 700; line-height: 1.15; color: var(--dir, var(--dim)); }
#tabular-whatif-prob { color: var(--dim); font-family: var(--font-data); font-size: .85rem; line-height: 1.4; }
#tabular-whatif-compare { font-weight: 600; margin: .3rem 0 0; }
#tabular-whatif-compare.flipped { color: var(--xai-ink); }
#tabular-whatif-footer {
  font-family: var(--font-data); font-size: .8rem; color: var(--dim);
  border-top: 1px solid var(--line); padding-top: .5rem; margin: .6rem 0 .2rem;
}
/* ONE column of rule rows, like every other host (owner, 2026-09-08). */
#tabular-whatif-rules { display: grid; gap: .3rem; }
#tabular-whatif-cf { margin: .2rem 0 0; line-height: 1.45; }
#tabular-whatif-fields, #tabular-whatif-weights { display: grid; gap: .3rem; }
/* A field row: name, the slider across the model's cut-offs (tick marks
   from its datalist), the number box, the one-change flip; a category has
   a dropdown in place of the slider and box. */
.tabular-whatif-field {
  position: relative; /* anchors the name's feature-help tooltip */
  display: grid; grid-template-columns: 11rem minmax(0, 1fr) 5.6rem minmax(0, 1fr);
  gap: .8rem; align-items: center; padding: .3rem .6rem; border-radius: .35rem; font-size: .88rem;
}
.tabular-whatif-field.categorical { grid-template-columns: 11rem minmax(0, 1fr) minmax(0, 1fr); }
.tabular-whatif-field.overridden { background: var(--xai-dim); }
.tabular-whatif-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 600; }
.tabular-whatif-field input[type="number"], .tabular-whatif-field select {
  margin: 0; padding: .25rem .4rem; font-family: var(--font-data); font-size: .85rem;
  border: 1px solid var(--edge); border-radius: .35rem; background: var(--panel); color: var(--ink);
  max-width: none; height: auto;
}
.tabular-whatif-field input[type="number"] { width: 5.6rem; font-variant-numeric: tabular-nums; text-align: right; }
.tabular-whatif-field select { min-width: 8rem; }

/* ---- Propose this change (2026-09-16): the Vision loop's recipe
   (.vision-loop / .vision-explain / .vision-maintain-lead / .vision-feed-meta
   from vision.css) with id twins of #vision-corrections-* and the record
   cards. ---- */
#tabular-propose-note { flex: 1 1 16rem; max-width: 28rem; height: 2.5rem; margin: 0; }
#tabular-propose-submit { background: var(--action); }
#tabular-propose-submit:disabled { opacity: .45; cursor: default; }
#tabular-propose-pending { margin: 0; font-family: var(--font-data); font-size: .85rem; }
#tabular-propose-done { margin: 0 0 1rem; font-size: .85rem; color: var(--xai-ink); font-weight: 600; }
#tabular-propose-done:empty { display: none; }
#tabular-proposals { background: var(--panel-2); border-radius: .8rem; padding: 1rem 1.1rem; max-width: 58rem; }
#tabular-proposals .caption { margin: .2rem 0 .7rem; line-height: 1.45; font-size: .85rem; }
#tabular-proposals-count { font-family: var(--font-data); font-size: .85rem; color: var(--dim); margin: 0 0 .2rem; }
#tabular-proposals-count.some { color: var(--xai-ink); font-weight: 700; }
#tabular-proposals-list { list-style: none; padding: 0; margin: 0; font-size: .85rem; display: grid; gap: .3rem; }
.tabular-proposal { display: flex; flex-direction: column; gap: .15rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.tabular-proposal-summary { font-weight: 600; color: var(--ink); }
.tabular-proposal-lines { margin: 0; padding-left: 1rem; color: var(--dim); }
.tabular-proposal-note { font-style: italic; color: var(--dim); }
.tabular-proposal .vision-feed-meta { margin-left: 0; }
#tabular-proposals-note { margin: 1rem 0 0; max-width: 58rem; line-height: 1.5; }

/* Notes read darker over the pale ground, as on the Vision pages. */
#xai-tabular .caption, #xai-tabular-model .caption, #xai-tabular-result .caption { color: var(--ink); }

@media (max-width: 46rem) {
  .tabular-whatif-field, .tabular-whatif-field.categorical { grid-template-columns: 1fr; row-gap: .3rem; }
}
@media (max-width: 34rem) {
  .xai-space-toggle { grid-template-columns: 1fr; }
  .xai-space-toggle .xai-space-pill { display: none; }
  .tabular-gauge { grid-template-columns: auto 1fr auto; }
}
@media (prefers-reduced-motion: reduce) {
  .xai-space-toggle .xai-space-pill, .tabular-gauge-track i { transition: none; }
  #tabular-verdict-label { animation: none; }
}
