/* ICIS Core — app styles (Bootstrap 5.3 base) */
:root {
  --icis-sb-w: 272px;
  --icis-sb-bg: #1f2a37;
  --icis-sb-fg: #c9d3de;
  --icis-sb-hover: #2b3949;
  --icis-sb-active: #2563eb;
  --icis-top-h: 52px;
  --icis-bg: #f3f5f8;
}
[data-bs-theme=dark] {
  --icis-sb-bg: #111820;
  --icis-sb-fg: #aeb9c5;
  --icis-sb-hover: #1b2530;
  --icis-bg: #0d1117;
}
body { background: var(--icis-bg); font-size: .875rem; }

/* ---------------------------------------------------------------- shell */
.icis-shell { display: flex; min-height: 100vh; }
.icis-sidebar {
  width: var(--icis-sb-w); flex: 0 0 var(--icis-sb-w);
  background: var(--icis-sb-bg); color: var(--icis-sb-fg);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; transition: width .15s, flex-basis .15s;
  scrollbar-width: thin; scrollbar-color: #3b4a5c transparent;
}
.icis-brand { display: flex; align-items: center; gap: .6rem; height: var(--icis-top-h); padding: 0 1rem; color: #fff; text-decoration: none; font-weight: 600; font-size: 1rem; border-bottom: 1px solid rgba(255,255,255,.06); flex-shrink: 0; }
.icis-brand i { font-size: 1.3rem; color: #60a5fa; }
.icis-menu-search { padding: .6rem .75rem; }
.icis-menu-search input { background: rgba(255,255,255,.06); border-color: transparent; color: #fff; }
.icis-menu-search input::placeholder { color: #8a97a6; }
.icis-menu { padding-bottom: 2rem; }
.icis-menu ul { list-style: none; margin: 0; padding: 0; }
.icis-menu li > ul { display: none; }
.icis-menu li.open > ul { display: block; }
.icis-menu-item {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  padding: .42rem .75rem .42rem calc(.9rem + var(--d, 0) * 0.95rem);
  color: var(--icis-sb-fg); text-decoration: none; background: none; border: 0; text-align: left;
  font-size: .8125rem; line-height: 1.25; border-left: 3px solid transparent;
}
.icis-menu-item:hover { background: var(--icis-sb-hover); color: #fff; }
.icis-menu-item.active { background: rgba(37,99,235,.18); color: #fff; border-left-color: var(--icis-sb-active); }
.icis-menu-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.icis-menu-item > .bi:first-child { width: 1rem; text-align: center; opacity: .8; flex-shrink: 0; }
.icis-menu-item .caret { font-size: .7rem; transition: transform .15s; opacity: .6; }
.icis-menu li.open > .icis-menu-item .caret { transform: rotate(90deg); }
.icis-menu li.has-kids > button.icis-menu-item { font-weight: 500; }
.icis-menu [data-depth="0"] > li > .icis-menu-item { font-weight: 600; color: #e5ebf1; }
.icis-menu-sep { height: 1px; background: rgba(255,255,255,.08); margin: .3rem .9rem; }
.icis-menu .sub-self { font-style: italic; opacity: .8; }
.icis-menu .admin { border-top: 1px solid rgba(255,255,255,.08); margin-top: .5rem; padding-top: .5rem; }

html.sb-min:not(.nav-top) .icis-sidebar { width: 58px; flex-basis: 58px; }
html.sb-min:not(.nav-top) .icis-sidebar .t, html.sb-min:not(.nav-top) .icis-sidebar .caret, html.sb-min:not(.nav-top) .icis-brand span, html.sb-min:not(.nav-top) .icis-menu-search, html.sb-min:not(.nav-top) .icis-menu li > ul { display: none !important; }
html.sb-min:not(.nav-top) .icis-menu-item { padding-left: 1.2rem; }

/* topbar: text size (A- 100% A+) + menu position toggle */
.icis-fontsize .btn { padding-left: .3rem; padding-right: .3rem; line-height: 1; }
.icis-fontsize .fz-a { font-weight: 600; font-family: Georgia, 'Times New Roman', serif; }
.icis-fontsize .fz-a.sm { font-size: .8rem; }
.icis-fontsize .fz-a.lg { font-size: 1.05rem; }
.icis-fontsize .bi { font-size: .7rem; vertical-align: top; }
#navToggle .nav-ico-top { display: none; }
html.nav-top #navToggle .nav-ico-top { display: inline-block; }
html.nav-top #navToggle .nav-ico-left { display: none; }

/* ------------------------------------------------ top (horizontal) menu — desktop only; phones keep the slide-in sidebar */
@media (min-width: 992px) {
  html.nav-top #sbToggle { display: none; }
  html.nav-top .icis-shell { flex-direction: column; }
  /* 2026-11-02: top menu stays pinned while the page scrolls; the page topbar sits just under it (--icis-nav-h, set by app.js) */
  html.nav-top .icis-sidebar {
    width: auto; flex: 0 0 auto; height: auto; position: sticky; top: 0; overflow: visible;
    flex-direction: row; align-items: stretch; z-index: 1030; transition: none;
  }
  html.nav-top .icis-brand { height: auto; min-height: 44px; border-bottom: 0; border-right: 1px solid rgba(255,255,255,.06); }
  html.nav-top .icis-menu-search { display: none; }
  html.nav-top .icis-menu { padding: 0; flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: stretch; }
  html.nav-top .icis-menu > ul { display: flex; flex-wrap: wrap; align-items: stretch; }
  html.nav-top .icis-menu > ul.admin { margin: 0 0 0 auto; padding: 0; border-top: 0; border-left: 1px solid rgba(255,255,255,.08); }
  html.nav-top .icis-menu li { position: relative; }
  /* dropdown open state is .dd-open (server-side .open = current path, only highlighted here) */
  html.nav-top .icis-menu li > ul { display: none !important; }
  html.nav-top .icis-menu li.dd-open > ul { display: block !important; }
  html.nav-top .icis-menu > ul > li > .icis-menu-item {
    height: 100%; min-height: 44px; padding: .5rem .8rem; white-space: nowrap;
    border-left: 0; border-bottom: 3px solid transparent;
  }
  html.nav-top .icis-menu > ul > li > .icis-menu-item { width: auto; padding: .5rem .7rem; gap: .4rem; }
  html.nav-top .icis-menu > ul > li > .icis-menu-item .t { flex: 0 1 auto; overflow: visible; }
  html.nav-top .icis-menu > ul > li > .icis-menu-item .caret { transform: rotate(90deg); margin-left: .1rem; }
  html.nav-top .icis-menu > ul > li.open > .icis-menu-item,
  html.nav-top .icis-menu > ul > li > .icis-menu-item.active { border-bottom-color: var(--icis-sb-active); background: none; color: #fff; }
  html.nav-top .icis-menu > ul > li.dd-open > .icis-menu-item { background: var(--icis-sb-hover); color: #fff; }
  html.nav-top .icis-menu > ul > .icis-menu-sep { width: 1px; height: auto; margin: .6rem .2rem; }
  /* level 1 dropdown */
  html.nav-top .icis-menu li > ul {
    position: absolute; top: 100%; left: 0; min-width: 240px; max-width: 340px; padding: .3rem 0;
    background: var(--icis-sb-bg); border: 1px solid rgba(255,255,255,.08); border-radius: 0 0 .45rem .45rem;
    box-shadow: 0 .6rem 1.4rem rgba(0,0,0,.28); z-index: 1035;
  }
  html.nav-top .icis-menu li > ul.flip { left: auto; right: 0; }
  /* level 2+ fly out to the side */
  html.nav-top .icis-menu li li > ul { top: -.3rem; left: 100%; border-radius: .45rem; }
  html.nav-top .icis-menu li li > ul.flip { left: auto; right: 100%; }
  html.nav-top .icis-menu li li > .icis-menu-item { padding-left: .9rem; }
  html.nav-top .icis-menu li li.open > .icis-menu-item .caret { transform: none; }
  html.nav-top .icis-menu li li.dd-open > .icis-menu-item { background: var(--icis-sb-hover); color: #fff; }
  html.nav-top .icis-menu li li.open > .icis-menu-item:not(.active) { color: #fff; }
}

.icis-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.icis-topbar { height: var(--icis-top-h); display: flex; align-items: center; gap: .5rem; padding: 0 1rem; background: var(--bs-body-bg); border-bottom: 1px solid var(--bs-border-color); position: sticky; top: var(--icis-nav-h, 0px); z-index: 1020; }
.icis-crumb { font-weight: 500; color: var(--bs-secondary-color); }
.icis-content { padding: 1rem 1.25rem 3rem; }

@media (max-width: 991.98px) {
  .icis-sidebar { position: fixed; left: calc(-1 * var(--icis-sb-w)); z-index: 1040; transition: left .2s; }
  body.sb-open .icis-sidebar { left: 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  html.sb-min .icis-sidebar { width: var(--icis-sb-w); }
  .icis-content { padding: .75rem .75rem 3rem; }
}

/* ---------------------------------------------------------------- login */
.icis-login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #1f2a37, #2563eb); padding: 1rem; }
.icis-login-card { width: 100%; max-width: 380px; border: 0; }
.icis-login-logo { width: 56px; height: 56px; border-radius: 14px; background: #2563eb; color: #fff; display: grid; place-items: center; font-size: 1.6rem; margin: 0 auto .75rem; }

/* ---------------------------------------------------------------- grid */
.icis-grid { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .5rem; position: relative; }
.icis-grid.loading::after { content: ''; position: absolute; inset: 0; background: rgba(var(--bs-body-bg-rgb), .45); border-radius: .5rem; }
/* PHPRunner-style where tabs above the grid toolbar */
.icis-wtabs { padding: .5rem .5rem 0; gap: .15rem; border-bottom: 1px solid var(--bs-border-color); flex-wrap: wrap; }
.icis-wtabs .nav-link { padding: .35rem .85rem; font-size: .875rem; color: var(--bs-secondary-color); }
.icis-wtabs .nav-link.active { color: var(--bs-emphasis-color); font-weight: 600; }
.icis-wtabs .badge { font-weight: 500; }
.icis-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; padding: .5rem; border-bottom: 1px solid var(--bs-border-color); align-items: center; }
.icis-qsearch { width: 220px; }
.icis-table-wrap { overflow-x: auto; overflow-y: hidden; }   /* page scrolls vertically; only wide tables scroll sideways */
.icis-table { font-size: .8125rem; }
.icis-table thead th { position: relative; z-index: 2; transform: translateY(var(--hdr-y, 0px)); background: var(--bs-tertiary-bg); white-space: nowrap; font-weight: 600; vertical-align: middle; box-shadow: inset 0 -1px 0 var(--bs-border-color); }
.icis-table thead th.sorted { background: var(--bs-primary-bg-subtle); }
.icis-table thead th.filtered .th-filter { color: var(--bs-warning-text-emphasis); }
.th-inner { display: flex; align-items: center; gap: .25rem; }
th.text-center .th-inner { justify-content: center; }
th.text-end .th-inner { justify-content: flex-end; }
.th-label { cursor: pointer; user-select: none; flex: 1; }
.th-filter { border: 0; background: none; padding: 0 .15rem; color: var(--bs-secondary-color); opacity: .55; }
th:hover .th-filter, .th-filter:focus { opacity: 1; }
.icis-table td { max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icis-grid.wrap .icis-table td { white-space: normal; max-width: 420px; }
.icis-table td br { display: none; }
.icis-grid.wrap .icis-table td br { display: inline; }
.icis-table .c-check, .icis-table .c-exp { width: 1%; text-align: center; white-space: nowrap; }
.icis-table .c-exp .badge { font-size: .65rem; margin-left: .15rem; }
.icis-table .c-act { width: 1%; white-space: nowrap; padding: 0 .15rem; }
.icis-actions { display: flex; gap: 0; }
.icis-actions .btn-link { padding: .1rem .3rem; color: var(--bs-secondary-color); }
.icis-actions .btn-link:hover { color: var(--bs-primary); }
.icis-actions .btn-sm:not(.btn-link) { padding: .1rem .35rem; margin-right: 2px; }
.icis-table tr.editing td { background: var(--bs-warning-bg-subtle) !important; padding: 2px 3px; }
.icis-table tr.editing .form-control, .icis-table tr.editing .form-select { min-width: 110px; font-size: .8125rem; padding: .15rem .35rem; }
.icis-table tr.editing textarea { min-width: 200px; }
.icis-table tr.saving { opacity: .6; pointer-events: none; }
.icis-table tr.flash td { animation: icisflash 1.2s ease-out; }
@keyframes icisflash { from { background: var(--bs-success-bg-subtle); } }
.icis-pager { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .5rem; border-top: 1px solid var(--bs-border-color); }
.icis-detail-row > td { background: var(--bs-secondary-bg) !important; padding: .5rem .5rem .75rem 2.25rem !important; }
.icis-detail-box .nav-tabs .nav-link { padding: .3rem .75rem; font-size: .8125rem; }
.icis-detail-box .icis-grid { border-top-left-radius: 0; }
.icis-thumb { max-height: 48px; max-width: 80px; border-radius: 4px; }

.icis-filter-pop { position: absolute; z-index: 1070; width: 290px; font-size: .8125rem; }
.icis-filter-values { max-height: 230px; overflow-y: auto; padding: 0 .25rem; }
.icis-colchooser { max-height: 60vh; overflow-y: auto; min-width: 230px; }

/* filter builder (2026-11-02) */
.icis-fb-group { border: 1px solid var(--bs-border-color); border-radius: .375rem; padding: .6rem .75rem .75rem; background: var(--bs-body-bg); box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.icis-fb-group .icis-fb-group { margin: .25rem 0 .25rem 1.25rem; background: var(--bs-tertiary-bg); box-shadow: none; }
.icis-fb-group.off > .icis-fb-items, .icis-fb-group.off > .icis-fb-head > span { opacity: .45; }
.icis-fb-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; font-size: .875rem; }
.icis-fb-match { border: 0; background: transparent; color: var(--bs-danger); font-weight: 600; text-decoration: underline dotted; padding: 0 .1rem; cursor: pointer; }
.icis-fb-items { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .5rem; }
.icis-fb-cond { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(130px, 1fr) minmax(160px, 1.4fr) auto auto; gap: .4rem; align-items: center; }
.icis-fb-cond.off > :not([data-fb]) { opacity: .45; }
.icis-fb-cond .btn-link, .icis-fb-head .btn { line-height: 1; }
.icis-fb-cond .btn-link.active, .icis-fb-head .btn.active { color: var(--bs-danger) !important; }
@media (max-width: 576px) { .icis-fb-cond { grid-template-columns: 1fr 1fr auto auto; } .icis-fb-cond .icis-fb-val { grid-column: 1 / 3; grid-row: 2; } }
.icis-fb-summary { display: flex; align-items: center; gap: .4rem; padding: .3rem .6rem; font-size: .8125rem; background: var(--bs-primary-bg-subtle); border-bottom: 1px solid var(--bs-border-color); }
.icis-fb-summary a { color: var(--bs-primary-text-emphasis); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icis-fb-summary a:hover { text-decoration: underline; }
.icis-fb-summary.off { background: var(--bs-secondary-bg); }
.icis-fb-summary.off a { color: var(--bs-secondary-color); text-decoration: line-through; }
.icis-fb-summary .btn-close-sm { font-size: .6rem; }

/* ---------------------------------------------------------------- forms: sections / tabs / steps */
.icis-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem 1.25rem; }
.icis-field.wide { grid-column: 1 / -1; }
.icis-field.newrow { grid-column-start: 1; }   /* field config "newRow": true (2026-10-23) */
.icis-field .form-label { font-size: .75rem; font-weight: 600; color: var(--bs-secondary-color); margin-bottom: .2rem; text-transform: none; }
.icis-ro { min-height: calc(1.5em + .75rem + 2px); padding: .375rem .6rem; background: var(--bs-tertiary-bg); border-radius: .375rem; }
.icis-section-head { display: flex; align-items: center; gap: .4rem; width: 100%; border: 0; text-align: left; font-weight: 600; font-size: .85rem; }
.icis-section-head .bi-chevron-down { transition: transform .15s; }
.icis-section-head.collapsed .bi-chevron-down { transform: rotate(-90deg); }
.icis-tabs .nav-link { font-weight: 500; }
.icis-form-actions { position: sticky; bottom: 0; background: var(--icis-bg); padding: .75rem 0; display: flex; flex-wrap: wrap; gap: .5rem; border-top: 1px solid var(--bs-border-color); z-index: 5; }
.modal .icis-form-actions { background: var(--bs-body-bg); }

.icis-stepper { display: flex; list-style: none; padding: 0; margin: 0; counter-reset: s; overflow-x: auto; }
.icis-stepper li { flex: 1; display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; position: relative; cursor: pointer; color: var(--bs-secondary-color); min-width: 140px; }
.icis-stepper li:not(:last-child)::after { content: ''; flex: 1; height: 2px; background: var(--bs-border-color); margin-left: .5rem; }
.icis-stepper .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bs-secondary-bg); font-weight: 600; flex-shrink: 0; border: 2px solid var(--bs-border-color); }
.icis-stepper li.current { color: var(--bs-body-color); font-weight: 600; }
.icis-stepper li.current .num { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.icis-stepper li.done .num { background: var(--bs-success); border-color: var(--bs-success); color: #fff; }
.icis-stepper li.done::after { background: var(--bs-success); }
.icis-stepper .lbl { white-space: nowrap; }

/* view page */
.icis-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 1.5rem; margin: 0; }
.icis-dl-row { display: grid; grid-template-columns: 38% 1fr; gap: .5rem; padding: .4rem 0; border-bottom: 1px dashed var(--bs-border-color); }
.icis-dl dt { font-weight: 600; color: var(--bs-secondary-color); font-size: .78rem; }
.icis-dl dd { margin: 0; word-break: break-word; }

/* home */
.icis-tile { transition: transform .1s; }
.icis-tile:hover { transform: translateY(-2px); }

/* admin */
.icis-rights th, .icis-rights td { text-align: center; vertical-align: middle; }
.icis-rights td:first-child, .icis-rights th:first-child { text-align: left; }
.icis-rights thead th { position: sticky; top: 0; background: var(--bs-tertiary-bg); z-index: 2; }
.icis-tree ul { list-style: none; padding-left: 1.4rem; margin: 0; border-left: 1px dashed var(--bs-border-color); }
.icis-tree > ul { padding-left: 0; border: 0; }
.icis-tree .node { display: flex; align-items: center; gap: .35rem; padding: .2rem .35rem; border-radius: .3rem; }
.icis-tree .node:hover { background: var(--bs-tertiary-bg); }
.icis-tree .node.sel { background: var(--bs-primary-bg-subtle); }
.icis-tree .node .ttl { flex: 1; cursor: pointer; }
.icis-designer .grp { border: 1px solid var(--bs-border-color); border-radius: .5rem; background: var(--bs-body-bg); margin-bottom: .75rem; }
.icis-designer .grp-head { display: flex; gap: .5rem; align-items: center; padding: .5rem; border-bottom: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); border-radius: .5rem .5rem 0 0; }
.icis-designer .drop { min-height: 44px; padding: .5rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.icis-designer .drop.over { background: var(--bs-primary-bg-subtle); }
.icis-designer .chip { padding: .25rem .6rem; border: 1px solid var(--bs-border-color); border-radius: 999px; background: var(--bs-body-bg); cursor: grab; font-size: .8rem; user-select: none; }
.icis-designer .chip.ro { border-style: dashed; color: var(--bs-secondary-color); }
.icis-designer .chip.dragging { opacity: .4; }

@media print {
  .icis-sidebar, .icis-topbar, .icis-form-actions, .btn, .icis-toolbar, .icis-wtabs, .icis-pager { display: none !important; }
  .icis-content { padding: 0; }
}

/* Tom Select dropdowns attached to <body> (popup forms) must sit above the modal (1055) and its backdrop */
body > .ts-dropdown { z-index: 1070; }

/* sticky header (moved by JS because the sideways scroll box blocks CSS sticky) */
.icis-table thead.stuck th { box-shadow: inset 0 -1px 0 var(--bs-border-color), 0 2px 4px rgba(0,0,0,.08); }
/* sideways scrollbar pinned to the bottom of the screen while the table's own one is off-screen */
.icis-hbar { position: fixed; bottom: 0; height: 16px; overflow-x: auto; overflow-y: hidden; z-index: 1030; display: none; background: var(--bs-body-bg); border-top: 1px solid var(--bs-border-color); }
.icis-hbar > div { height: 1px; }
/* top-level grids: no scrollbar inside the grid — the pinned .icis-hbar at the bottom of the window does the sideways scrolling */
.icis-table-wrap.icis-own-bar-off { scrollbar-width: none; }
.icis-table-wrap.icis-own-bar-off::-webkit-scrollbar { display: none; }
.icis-content { padding-bottom: calc(3rem + 16px); }   /* room for the pinned bar under the pager */

.icis-detail-box .icis-table-wrap { --hdr-y: 0px; }   /* nested grids: header never moves */

/* links that are just an icon or image: no underline */
.icis-table td a:has(> i:only-child), .icis-table td a:has(> img:only-child) { text-decoration: none; }

/* filter row under admin table headers */
.icis-filter-row th { padding: .25rem .3rem; background: var(--bs-tertiary-bg); font-weight: normal; }
.icis-filter-row .form-control, .icis-filter-row .form-select { min-width: 0; font-size: .78rem; }
.icis-filter-row .icis-filter-check { min-width: 3.4rem; padding-right: 1.4rem; }
.icis-rights thead tr:first-child th, .icis-rights thead .icis-filter-row th { position: sticky; z-index: 2; }
.icis-rights thead tr:first-child th { top: calc(var(--icis-nav-h, 0px) + var(--icis-top-h)); background: var(--bs-body-bg); }
.icis-rights thead .icis-filter-row th { top: calc(var(--icis-nav-h, 0px) + var(--icis-top-h) + var(--icis-rights-h, 70px)); }

/* one scroll everywhere: pages scroll with the window (like the module grids), no inner scroll boxes.
   Tables in .icis-page-table only scroll sideways on narrow screens; the header sticks under the top bar. */
.icis-page-table { overflow: visible; }
@media (max-width: 767.98px) { .icis-page-table { overflow-x: auto; } }
/* Save bar stays reachable at the bottom of the screen on long admin pages */
.icis-sticky-footer { position: sticky; bottom: 0; z-index: 3; background: var(--bs-body-bg); box-shadow: 0 -2px 6px rgba(0,0,0,.06); }

.icis-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.icis-sortable:hover { color: var(--bs-primary); }
.icis-sort-ind { margin-left: .25rem; font-size: .8em; color: var(--bs-primary); }
.icis-sortable:not([aria-sort=ascending]):not([aria-sort=descending]):hover .icis-sort-ind::before { content: "\f127"; opacity: .4; } /* bi-arrow-down-up */

/* admin Permissions / Modules: menu folders as group rows (2026-10-16) */
.icis-group-row td { background: var(--bs-tertiary-bg); font-weight: 600; font-size: .85rem; }
.icis-group-row td:first-child { white-space: nowrap; }
.icis-group-muted td { color: var(--bs-secondary-color); font-style: italic; }
/* folder collapse in Permissions (2026-11-04, like the Menu editor) */
tr.icis-folded { display: none !important; }
.icis-fold-cell { cursor: pointer; user-select: none; }
.icis-fold-tog { font-size: .7rem; margin-right: .3rem; color: var(--bs-secondary-color); }
.icis-fold-cell:hover .icis-fold-tog { color: var(--bs-primary); }
.icis-fold-n { font-size: .7rem; display: none; }
tr.icis-fold-closed .icis-fold-n { display: inline-block; }
tr.icis-fold-closed .bi-folder2-open::before { content: "\f3d9"; } /* bi-folder2 */
.icis-fold-off .icis-fold-cell { cursor: default; }
.icis-fold-off .icis-fold-tog { opacity: .35; }
/* read-only reference rows (a child module listed elsewhere) + jump highlight (2026-10-16) */
.icis-ref-row td { color: var(--bs-secondary-color); background: transparent; }
.icis-ref-row .icis-ref-go { color: var(--bs-secondary-color); text-decoration: underline dotted; }
.icis-ref-row .icis-ref-mark.bi-check-lg { color: var(--bs-success); }
.icis-ref-row .icis-ref-mark.bi-dash { opacity: .35; }
@keyframes icis-flash { from { background: var(--bs-warning-bg-subtle); } to { background: transparent; } }
tr.icis-flash > td { animation: icis-flash 2s ease-out; }

/* yes/no (checkbox / boolean) cells: green tick, red cross (2026-10-19) */
.icis-bool { font-size: .95rem; line-height: 1; -webkit-text-stroke: .6px currentColor; }
.icis-bool-yes { color: #3c8d40; }
.icis-bool-no  { color: #d0453f; font-size: .8rem; -webkit-text-stroke: .9px currentColor; }
[data-bs-theme=dark] .icis-bool-yes { color: #5cb860; }
[data-bs-theme=dark] .icis-bool-no  { color: #e8655f; }

/* multi-select tag box inside an inline-edit grid row (2026-10-19) */
.icis-table tr.editing .ts-wrapper { min-width: 180px; }
.icis-table tr.editing .ts-wrapper .ts-control { font-size: .8125rem; padding: 2px 4px; min-height: 31px; }
.icis-table tr.editing .ts-wrapper.multi .ts-control > .item { margin: 1px 2px; padding: 0 4px; }

/* signature pad (2026-10-19) */
.icis-sig-box { position: relative; border: 1px dashed var(--bs-border-color); border-radius: var(--bs-border-radius); overflow: hidden; touch-action: none; }
.icis-sig-box canvas { display: block; width: 100%; height: auto; cursor: crosshair; }
.icis-sig-hint { position: absolute; left: 10px; bottom: 6px; font-size: .75rem; color: #adb5bd; pointer-events: none; }
.icis-sig.signed .icis-sig-hint { display: none; }
.icis-sig-box::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 24px; border-bottom: 1px solid #dee2e6; pointer-events: none; }
.icis-sig-cur img { max-height: 110px; max-width: 100%; background: #fff; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); padding: 4px; }
.icis-sig-tools .btn { padding: .15rem .5rem; font-size: .8rem; }

/* Record History panel (view page, 2026-10-19) */
.icis-history .icis-hist-list { max-height: 420px; overflow-y: auto; font-size: .85rem; }
.icis-history .icis-hist-list li { padding: 3px 0; border-bottom: 1px dashed var(--bs-border-color-translucent); line-height: 1.4; }
.icis-history .icis-hist-list li:last-child { border-bottom: 0; }
.icis-history .icis-hist-when { color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; }
.icis-history .nav-pills .nav-link { font-size: .75rem; }
@media print { .icis-history .icis-hist-list { max-height: none; overflow: visible; } }

/* long text in grid cells: a few lines + "More …" popup (2026-10-20) */
.icis-table td.has-clamp { white-space: normal; min-width: 220px; max-width: 360px; }
.icis-table td.has-clamp br, .icis-grid.wrap .icis-table td.has-clamp br { display: initial; }
.icis-clamp { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.icis-grid.wrap .icis-clamp { -webkit-line-clamp: 5; line-clamp: 5; }
.icis-clamp p { margin: 0 0 .25rem; }
.icis-more { display: inline-block; font-size: .78rem; margin-top: 2px; text-decoration: none; }
.icis-more:hover { text-decoration: underline; }
.icis-more-body { white-space: normal; overflow-wrap: anywhere; max-height: 70vh; overflow-y: auto; }
@media print { .icis-clamp { display: block; -webkit-line-clamp: unset; } .icis-more { display: none; } }

/* rich text editor (TinyMCE) in forms (2026-10-20) */
.icis-field .tox-tinymce { border-radius: var(--bs-border-radius); border-color: var(--bs-border-color); }
.icis-field .tox .tox-toolbar__group { padding: 0 4px; }
.tox-tinymce-aux { z-index: 1080 !important; }   /* menus / dialogs above Bootstrap modals */

/* ---- calendar page (views/calendar.php) ---- */
#icis-cal { --fc-border-color: var(--bs-border-color); --fc-page-bg-color: var(--bs-body-bg); --fc-neutral-bg-color: var(--bs-tertiary-bg);
  --fc-list-event-hover-bg-color: var(--bs-tertiary-bg); --fc-today-bg-color: rgba(255, 193, 7, .12); font-size: .875rem; }
#icis-cal .fc-toolbar-title { font-size: 1.25rem; }
#icis-cal .fc-button { font-size: .8rem; text-transform: capitalize; }
#icis-cal a { text-decoration: none; }
#icis-cal .fc-col-header-cell-cushion, #icis-cal .fc-daygrid-day-number { color: var(--bs-body-color); }
#icis-cal .fc-event { cursor: pointer; }
#icis-cal .fc-daygrid-block-event .fc-event-title { white-space: normal; }   /* long titles wrap instead of being cut */
#icis-cal .icis-cal-off { opacity: .45; }
.icis-cal-tip .tooltip-inner { max-width: 360px; text-align: left; }
@media (max-width: 767.98px) {
  #icis-cal .fc-header-toolbar { flex-direction: column; gap: .5rem; }
  #icis-cal .fc-toolbar-title { font-size: 1.05rem; }
}

/* column totals row under the grid ("total" on a field) — 2026-10-22 */
.icis-table tfoot tr.icis-totals td { background: var(--bs-tertiary-bg); font-weight: 600; font-variant-numeric: tabular-nums; border-top: 2px solid var(--bs-border-color); white-space: nowrap; }
.icis-table tfoot tr.icis-totals td .lbl { font-weight: 400; color: var(--bs-secondary-color); font-size: .8em; }

/* pager also above the grid (2026-10-23) */
.icis-pager-top { border-top: 0; border-bottom: 1px solid var(--bs-border-color); }
.icis-pager-top:empty { display: none; }

/* Columns menu: show / hide + drag to reorder (2026-10-23) */
.icis-colrow { display: flex; align-items: center; gap: .35rem; padding: .1rem .25rem; border-radius: .25rem; }
.icis-colrow:hover { background: var(--bs-tertiary-bg); }
.icis-colrow.dragging { opacity: .45; background: var(--bs-primary-bg-subtle); }
.icis-colgrip { cursor: grab; color: var(--bs-secondary-color); }
.icis-colrow .btn-link { color: var(--bs-secondary-color); line-height: 1; }
.icis-colrow .btn-link:hover { color: var(--bs-primary); }

/* card view (2026-10-29): grid.cardView in the module JSON; header row stays for sort / filters */
.icis-cardmode .icis-table tbody, .icis-cardmode .icis-table tfoot { display: none; }
.icis-cardmode .icis-table thead th.c-check, .icis-cardmode .icis-table thead th.c-act { visibility: hidden; }
.icis-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: .75rem; margin: .75rem 0; }
.icis-card { border-color: var(--bs-primary-border-subtle); }
.icis-card .card-header { background: transparent; }
.icis-card-dl { font-size: .8125rem; }
.icis-card-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: .5rem; padding: .2rem 0; border-bottom: 1px solid var(--bs-border-color-translucent); }
.icis-card-row:last-child { border-bottom: 0; }
.icis-card-row dt { text-align: right; font-weight: 600; margin: 0; }
.icis-card-row dd { margin: 0; overflow-wrap: anywhere; }
.icis-card-row dd .icis-clamp { -webkit-line-clamp: 3; }

/* photo gallery (2026-10-30): "gallery" in an attachment module's JSON */
.icis-lb { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.88); display: flex; flex-direction: column; color: #fff; }
.icis-lb-top { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; }
.icis-lb-count { font-size: .9rem; opacity: .85; }
.icis-lb-stage { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; min-height: 0; }
.icis-lb-stage img { max-width: calc(100vw - 7rem); max-height: calc(100vh - 8rem); object-fit: contain; transition: transform .12s ease-out;
                     cursor: zoom-in; user-select: none; -webkit-user-drag: none; touch-action: none; box-shadow: 0 4px 24px rgba(0,0,0,.5); background: #222; }
.icis-lb.zoomed .icis-lb-stage img { cursor: grab; transition: none; }
.icis-lb-spin { position: absolute; display: none; }
.icis-lb.loading .icis-lb-spin { display: block; }
.icis-lb-cap { text-align: center; padding: .5rem 1rem .9rem; font-size: .9rem; min-height: 2.4rem; overflow-wrap: anywhere; }
.icis-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; border: 0; background: rgba(255,255,255,.12); color: #fff;
               width: 3rem; height: 3rem; border-radius: 50%; font-size: 1.4rem; display: flex; align-items: center; justify-content: center; }
.icis-lb-nav:hover { background: rgba(255,255,255,.28); }
.icis-lb-nav.prev { left: .75rem; } .icis-lb-nav.next { right: .75rem; }
.icis-lb.single .icis-lb-nav { display: none; }
body.icis-lb-open { overflow: hidden; }
[data-icis-gallery] a[href] img { cursor: zoom-in; }
@media (max-width: 576px) { .icis-lb-stage img { max-width: 100vw; } .icis-lb-nav { width: 2.4rem; height: 2.4rem; } }
