/* Enginatics data-page kit: search bar, filter dropdown, chips, count line, data table, pager, buttons, code box.
   Used by the library (v2); report and AI skills pages move onto it next (docs/proposal-data-pages.md).
   Look = the existing library/report pages: borders #ddd, radius 6px, links #0090ff, panel head #f6f6f6. */
:root {
  --en-line: #ddd;
  --en-soft: #f6f6f6;
  --en-code: #f9f9f9;
  --en-muted: #747474;
  --en-link: #0090ff;
  --en-text: #333;
  --en-red: #e10707;   /* brand red: only the one main action per page */
  --en-s1: 8px;        /* spacing scale */
  --en-s2: 16px;
  --en-s3: 24px;
}

/* search bar + filter, joined like the old library bar */
.en-search { display: flex; flex-wrap: wrap; align-items: stretch; margin: 10px 0 6px; position: relative; z-index: 20; }
.en-search__input { position: relative; flex: 1 1 360px; margin: 0; }
.en-search__input input[type=search] { width: 100%; height: 36px; padding: 0 40px 0 14px; border: 1px solid var(--en-line); border-radius: 6px 0 0 6px; font-size: 14px; background: #fff; box-sizing: border-box; }
.en-search__go { position: absolute; top: 0; right: 0; width: 38px; height: 36px; border: 0; background: none; color: #777; cursor: pointer; font-size: 15px; }
.en-filter { flex: 1 1 280px; position: relative; }
.en-filter > summary { list-style: none; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 34px 0 14px; border: 1px solid var(--en-line); border-left: 0; border-radius: 0 6px 6px 0; background: #fff; font-size: 14px; color: #555; cursor: pointer; position: relative; box-sizing: border-box; }
.en-filter > summary::-webkit-details-marker { display: none; }
.en-filter > summary::after { content: '▾'; position: absolute; right: 12px; color: #777; }
.en-filter[open] > summary::after { content: '▴'; }
.en-filter__n:not(:empty) { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #8e8e8e; color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.en-filter__panel { position: absolute; right: 0; top: 40px; width: min(640px, 92vw); max-height: 70vh; overflow: auto; padding: 10px 12px; background: #fff; border: 1px solid var(--en-line); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
/* Avada's footer is position:relative; z-index:9999 and #main is static, so the open panel was painted under the
   footer. Lift #main into its own stacking context above it while the panel is open (class set by en-library.js;
   :has() as a no-JS fallback, in a separate rule so older browsers don't drop the first one). */
.en-filter-open #main { position: relative; z-index: 10000; }
body:has(.en-filter[open]) #main { position: relative; z-index: 10000; }
.en-filter__find { width: 100%; height: 32px; padding: 0 10px; margin-bottom: 8px; border: 1px solid var(--en-line); border-radius: 4px; font-size: 14px; box-sizing: border-box; }
.en-filter__groups { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.en-filter fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.en-filter legend { font-weight: bold; padding: 0; margin-bottom: 4px; }
.en-filter fieldset label { display: flex; gap: 6px; align-items: baseline; font-size: 14px; line-height: 1.5; margin: 0; cursor: pointer; }
.en-filter fieldset label[hidden] { display: none; }
.en-filter fieldset label span { margin-left: auto; color: var(--en-muted); font-size: 12px; }
.en-filter__all { display: block; margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--en-line); font-size: 14px; }

/* module quick filter */
.en-modules { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 6px; }
.en-modules__label { font-size: 13px; color: var(--en-muted); margin-right: 2px; }
.en-module-chip { display: inline-flex; gap: 4px; align-items: baseline; padding: 1px 9px; border: 1px solid var(--en-line); border-radius: 14px; font-size: 13px; line-height: 1.7; color: var(--en-text); background: #fff; }
.en-module-chip span { font-size: 11px; color: var(--en-muted); }
.en-module-chip:hover, .en-module-chip:focus { border-color: var(--en-link); color: var(--en-text); }
.en-module-chip[aria-pressed=true] { background: var(--en-text); border-color: var(--en-text); color: #fff; }
.en-module-chip[aria-pressed=true] span { color: #ddd; }
.en-module { display: block; color: var(--en-text); }
.en-cats { display: block; font-size: 13px; line-height: 1.5; }

/* selected filters */
.en-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.en-chips:empty { display: none; }
.en-chip { display: inline-flex; gap: 4px; align-items: center; padding: 2px 10px; border: 1px solid var(--en-line); border-radius: 14px; background: var(--en-soft); color: var(--en-text); font-size: 13px; line-height: 1.6; cursor: pointer; }
.en-chip:hover, .en-chip:focus { border-color: var(--en-link); color: var(--en-text); }
.en-chip--clear { background: #fff; color: var(--en-link); }

.en-count { margin: 6px 0; }
.is-loading .en-count { opacity: .6; }

/* data table (old DataTables "row-border" look) */
.en-table { width: 100%; border-collapse: collapse; margin: 0 0 10px; }
.en-table th { text-align: left; font-weight: bold; padding: 8px 10px; border-bottom: 1px solid var(--en-line); }
.en-table th button { background: none; border: 0; padding: 0 16px 0 0; font: inherit; color: inherit; cursor: pointer; position: relative; }
.en-table th button::after { content: '⇅'; position: absolute; right: 0; color: #bbb; font-weight: normal; font-size: 12px; }
.en-table th[aria-sort=ascending] button::after { content: '▲'; color: #777; }
.en-table th[aria-sort=descending] button::after { content: '▼'; color: #777; }
.en-table td { padding: 10px; border-bottom: 1px solid var(--en-line); vertical-align: top; line-height: 1.5; }
.en-table--library .en-col-name { width: 25%; }
.en-table--library .en-col-cat { width: 16%; }
.en-table--library .en-col-dl { width: 80px; text-align: center; white-space: nowrap; }
.en-dl-icon { width: 23px; height: auto; margin: 0 1px; vertical-align: top; }
.en-dl-icon--secondary { opacity: .45; }
a:hover > .en-dl-icon--secondary, a:focus > .en-dl-icon--secondary { opacity: 1; }
.en-desc { white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.en-desc.is-open { display: block; -webkit-line-clamp: unset; }
.en-full { display: none; margin-left: 10px; font-size: 14px; }
.en-desc.is-open ~ .en-full { display: inline-block; }
.en-more { background: none; border: 0; padding: 0; color: var(--en-link); cursor: pointer; font: inherit; }
.en-empty { padding: 10px 0 20px; }

/* pager */
.en-pager { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; margin: 10px 0 20px; }
.en-pager a, .en-pager span { min-width: 32px; padding: 4px 8px; text-align: center; border-radius: 6px; line-height: 1.5; }
.en-pager a { border: 1px solid var(--en-line); color: var(--en-text); }
.en-pager a:hover, .en-pager a:focus { border-color: var(--en-link); }
.en-pager__current { background: #f00402; color: #fff; }
.en-pager__gap { color: var(--en-muted); }

/* server SQL search group */
.en-deep { margin-top: 20px; }
.en-deep__title { font-size: 18px; margin: 0 0 4px; }
.en-deep__hint, .en-deep__status { color: var(--en-muted); font-size: 14px; margin: 0 0 6px; }

/* buttons: report Excel/XML and AI skills Zip/SKILL.md/GitHub share one style */
a.en-btn, .en-btn { display: inline-block; min-width: 80px; padding: 8px 14px; border-radius: 4px; color: #fff !important; font-size: 16px; text-align: center; line-height: 1.3; text-decoration: none; }
.en-btn .fa { padding-right: 8px; }
a.en-btn:hover, a.en-btn:focus { filter: brightness(1.1); }
.en-btn--primary { background: var(--en-red); }
a.en-btn.en-btn--ghost, .en-btn--ghost { background: #fff; color: var(--en-text) !important; border: 1px solid var(--en-line); }
a.en-btn.en-btn--ghost:hover, a.en-btn.en-btn--ghost:focus { border-color: var(--en-link); filter: none; }
.en-btn--excel, .en-btn--zip { background: #168b24; }
.en-btn--xml, .en-btn--md { background: #2f6edb; }
.en-btn--sql, .en-btn--src { background: #727272; }
.en-buttons, .en-report-buttons { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; padding: 4px 0 8px; }

/* copy pill (report SQL, AI skills text and commands) */
.en-copy { padding: 0 14px; height: 23px; line-height: 23px; font-size: 14px; border: 0; border-radius: 50px; background: #8e8e8e; color: #fff; cursor: pointer; }
.en-copy:hover, .en-copy:focus { background: #6f6f6f; }
#sql_data { position: relative; }
.en-copy-sql { position: absolute; top: 8px; right: 10px; z-index: 5; }
pre.en-sql { margin: 0; padding: 10px; background: var(--en-code); white-space: pre; overflow-x: auto; font-size: 13px; line-height: 1.5; }

/* copyable command */
.en-code { position: relative; margin: 6px 0 10px; }
.en-code pre { margin: 0; padding: 8px 64px 8px 10px; background: var(--en-code); color: var(--en-text); border: 1px solid var(--en-line); border-radius: 6px; overflow-x: auto; font-size: 14px; line-height: 1.5; }
.en-code code { background: none; padding: 0; white-space: pre; color: inherit; }
.en-code .en-copy { position: absolute; top: 7px; right: 7px; }

/* tags */
.en-tag { display: inline-block; padding: 0 6px; margin-left: 4px; border-radius: 3px; font-size: 12px; line-height: 18px; white-space: nowrap; border: 1px solid; }
.en-tag--rules { color: #2f6edb; border-color: #9dbcf0; background: #f1f6fe; }
.en-tag--writes { color: #a15c00; border-color: #f0c58a; background: #fff7ec; }

/* report parameters table */
.en-table--params { border: 1px solid var(--en-line); }
.en-table--params th { background: var(--en-soft); }
.en-table--params td { padding: 6px 10px; }
.en-table--params td pre { margin: 0; white-space: pre-wrap; font-size: 13px; }

/* ---- visual rules for data pages (report, AI skills): section headings instead of grey panel bars ---- */
.en-report .reports-container, .ais .reports-container { border: 0; border-radius: 0; margin: 0 0 var(--en-s3); }
.en-report .reports-container__title, .ais .reports-container__title { text-align: left; background: none; border-radius: 0; border-bottom: 1px solid var(--en-line); padding: 0 0 6px; margin: 0 0 var(--en-s1); font-size: 16px; font-weight: 700; line-height: 1.4; letter-spacing: 0; text-transform: none; }
.en-report .reports-container__content, .ais .ais-panel .reports-container__content { padding: 0; }
.en-report .reports-container__content.content-list a, .ais .reports-container__content.content-list a { padding: 3px 0; }
.en-prose { max-width: 80ch; line-height: 1.6; }
.en-count-badge { font-weight: 400; font-size: 13px; color: var(--en-muted); margin-left: 6px; }

/* ---- report page ---- */
.en-report { margin-top: 20px; }
.en-report__title { margin: 0 0 var(--en-s1); }
.en-report__copy { font-size: 16px; vertical-align: super; }
.en-report__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--en-s1) var(--en-s2); margin: 0 0 var(--en-s3); }
.en-report__bar .back { margin: 0; }
.en-report__actions { display: flex; flex-wrap: wrap; gap: var(--en-s1); }
.en-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(240px, 1fr); gap: 32px; align-items: start; }
.en-side { position: sticky; top: 20px; }
.en-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px var(--en-s2); margin: 0 0 var(--en-s2); font-size: 15px; }
.en-facts dt { color: var(--en-muted); font-weight: 400; margin: 0; }
.en-facts dd { margin: 0; overflow-wrap: anywhere; }
.en-clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.en-clamp.is-open { display: block; -webkit-line-clamp: unset; }
.en-lov > summary { cursor: pointer; color: var(--en-link); font-size: 14px; list-style: none; display: inline; padding: 0; margin: 0; border: 0; background: none; }
.en-lov > summary::-webkit-details-marker, .en-lov > summary::before, .en-lov > summary::after { display: none; content: none; }
.en-lov[open] > summary { display: block; }
.en-lov[open] summary { margin-bottom: 4px; }
.en-table--params, .en-table--params th, .en-table--params td { border-left: 0 !important; border-right: 0 !important; border-top: 0 !important; }
.en-table--params { border: 0; }
.en-table--params th { background: none; }
.en-sql-box { position: relative; background: var(--en-code); border: 1px solid var(--en-line); border-radius: 6px; padding: 10px 12px; }
.en-sql-box .wp_syntax, .en-sql-box pre { background: none !important; border: 0 !important; margin: 0; }
.en-sql-box.is-collapsed #code_field { max-height: 26em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.en-sql-more { display: block; margin: 8px auto 0; padding: 6px 16px; border: 1px solid var(--en-line); border-radius: 50px; background: #fff; color: var(--en-text); font-size: 14px; cursor: pointer; }
.en-sql-more:hover, .en-sql-more:focus { border-color: var(--en-link); }
.en-help-content { line-height: 1.6; }
.en-help-content img { width: auto !important; max-width: 100%; height: auto; } /* style.css forces 23px on images in .reports-container__content */
.en-help-content table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
.en-help-content th, .en-help-content td { border: 1px solid var(--en-line); padding: 6px 10px; text-align: left !important; vertical-align: top; }
.en-help-content th { background: var(--en-soft); }
.en-table--params.is-collapsed tbody tr:nth-child(n+13) { display: none; }
.en-cta p { margin: 0 0 var(--en-s1); font-size: 15px; line-height: 1.5; }
.en-cta__actions { display: flex; flex-wrap: wrap; gap: var(--en-s1); }
.en-cta__actions .en-btn { font-size: 15px; padding: 7px 12px; }
.en-cta__more { font-size: 14px; }

@media (max-width: 900px) {
  .en-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .en-side { position: static; }
  .en-report__bar { align-items: flex-start; }
  .en-search__input input[type=search] { border-radius: 6px; }
  .en-filter { flex-basis: 100%; margin-top: 6px; }
  .en-filter > summary { border-left: 1px solid var(--en-line); border-radius: 6px; }
  .en-filter__panel { left: 0; right: auto; width: 100%; }
  .en-filter__groups { grid-template-columns: 1fr; }
  .en-table thead { display: none; }
  .en-table, .en-table tbody, .en-table tr, .en-table td { display: block; width: auto !important; }
  .en-table tr { padding: 10px 0; border-bottom: 1px solid var(--en-line); }
  .en-table td { border: 0; padding: 2px 0; text-align: left !important; }
  .en-pager { justify-content: center; }
}
@media print {
  .en-search, .en-chips, .en-pager, .en-col-dl, .en-more { display: none !important; }
  .en-desc { display: block; -webkit-line-clamp: unset; }
}
