/* NEO Tables – front-end styles */

.neo-table-wrap {
  --nt-accent: #0d2b6b;
  --nt-accent-2: #1a3a8a;
  --nt-head-bg: #0d2b6b;
  --nt-head-fg: #ffffff;
  --nt-bg: #ffffff;
  --nt-fg: #1f2937;
  --nt-muted: #6b7280;
  --nt-stripe: #f5f7fc;
  --nt-hover: #eaf0fb;
  --nt-border: #e3e8f2;
  --nt-highlight: #e8a020;
  --nt-radius: 14px;
  --nt-pad-y: 0.85rem;
  --nt-pad-x: 1rem;

  margin: 1.75rem 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--nt-fg);
}

.neo-table--amber {
  --nt-accent: #d4911a;
  --nt-accent-2: #e8a020;
  --nt-head-bg: #e8a020;
  --nt-head-fg: #1b1300;
  --nt-stripe: #fdf7ec;
  --nt-hover: #fbeed4;
  --nt-border: #f1e3c7;
  --nt-highlight: #0d2b6b;
}

.neo-table--minimal {
  --nt-head-bg: #f5f7fc;
  --nt-head-fg: #0d2b6b;
  --nt-stripe: #fafbfd;
  --nt-hover: #f1f4fa;
}

.neo-table--dark {
  --nt-accent: #e8a020;
  --nt-accent-2: #f0b240;
  --nt-head-bg: #091d4a;
  --nt-head-fg: #ffffff;
  --nt-bg: #0f1f45;
  --nt-fg: #e5e9f3;
  --nt-muted: #9aa6c2;
  --nt-stripe: #13265a;
  --nt-hover: #1a3270;
  --nt-border: #22397a;
  --nt-highlight: #e8a020;
}

.neo-table--compact {
  --nt-pad-y: 0.45rem;
  --nt-pad-x: 0.7rem;
  font-size: 0.88rem;
}

/* Title */
.neo-table__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--nt-accent);
}
.neo-table--dark .neo-table__title { color: #0d2b6b; }
.neo-table__title::before {
  content: "";
  width: 4px;
  height: 1.15em;
  border-radius: 4px;
  background: var(--nt-highlight);
}

.neo-table__sr {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Toolbar (search) */
.neo-table__toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}
.neo-table__search {
  position: relative;
  width: 100%;
  max-width: 280px;
}
.neo-table__search svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: #9aa3b5;
  pointer-events: none;
}
.neo-table__search input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.8rem 0.55rem 2.2rem;
  border: 1px solid #d9dfeb;
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
  color: #1f2937;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.neo-table__search input:focus {
  border-color: var(--nt-accent-2);
  box-shadow: 0 0 0 3px rgba(26, 58, 138, 0.15);
}

/* Table shell */
.neo-table__scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--nt-border);
  border-radius: var(--nt-radius);
  background: var(--nt-bg);
  box-shadow: 0 1px 2px rgba(13, 43, 107, 0.04), 0 6px 20px -8px rgba(13, 43, 107, 0.12);
}

.neo-table-wrap table.neo-table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  table-layout: auto;
}

.neo-table-wrap .neo-table th,
.neo-table-wrap .neo-table td {
  padding: var(--nt-pad-y) var(--nt-pad-x);
  border: 0;
  border-bottom: 1px solid var(--nt-border);
  vertical-align: top;
  text-align: left;
}
.neo-table-wrap .neo-table tbody tr:last-child > * { border-bottom: 0; }

.neo-table-wrap .neo-table thead th {
  background: var(--nt-head-bg);
  color: var(--nt-head-fg);
  font-weight: 600;
  font-size: 0.82em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 0;
  vertical-align: middle;
}
.neo-table--minimal .neo-table thead th { border-bottom: 2px solid var(--nt-highlight); }

.neo-table-wrap .neo-table tbody th {
  font-weight: 600;
  color: var(--nt-accent);
}
.neo-table--dark .neo-table tbody th { color: #fff; }

.neo-table-wrap .neo-table td a,
.neo-table-wrap .neo-table tbody th a {
  color: var(--nt-accent-2);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.neo-table--dark .neo-table td a { color: var(--nt-accent); }

.neo-table--striped .neo-table tbody tr:nth-child(even) > * { background: var(--nt-stripe); }
.neo-table--hover .neo-table tbody tr { transition: background-color .12s; }
.neo-table--hover .neo-table tbody tr:hover > * { background: var(--nt-hover); }

.neo-table--bordered .neo-table th + th,
.neo-table--bordered .neo-table th + td,
.neo-table--bordered .neo-table td + td,
.neo-table--bordered .neo-table td + th { border-left: 1px solid var(--nt-border); }
.neo-table--bordered .neo-table thead th + th { border-left-color: rgba(255, 255, 255, 0.15); }
.neo-table--minimal.neo-table--bordered .neo-table thead th + th { border-left-color: var(--nt-border); }

.neo-table-wrap .neo-align-left { text-align: left; }
.neo-table-wrap .neo-align-center { text-align: center; }
.neo-table-wrap .neo-align-right { text-align: right; font-variant-numeric: tabular-nums; }

/* Sorting */
.neo-table-wrap[data-sort="1"] .neo-table thead th {
  cursor: pointer;
  user-select: none;
}
.neo-table__sort-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.neo-table__sort-btn:focus-visible { outline: 2px solid var(--nt-highlight); outline-offset: 3px; border-radius: 3px; }
.neo-table__sort-icon {
  display: inline-block;
  width: 8px;
  height: 12px;
  opacity: 0.45;
  position: relative;
}
.neo-table__sort-icon::before,
.neo-table__sort-icon::after {
  content: "";
  position: absolute;
  left: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.neo-table__sort-icon::before { top: 0; border-bottom: 4px solid currentColor; }
.neo-table__sort-icon::after { bottom: 0; border-top: 4px solid currentColor; }
th[aria-sort="ascending"] .neo-table__sort-icon,
th[aria-sort="descending"] .neo-table__sort-icon { opacity: 1; }
th[aria-sort="ascending"] .neo-table__sort-icon::after { opacity: 0.25; }
th[aria-sort="descending"] .neo-table__sort-icon::before { opacity: 0.25; }

/* Empty state */
.neo-table__empty td {
  text-align: center !important;
  color: var(--nt-muted);
  padding: 2rem 1rem !important;
}

/* Footer: note + pagination */
.neo-table__note {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: #6b7280;
}
.neo-table__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: #6b7280;
}
.neo-table__pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.neo-table__pager button {
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 0.6rem;
  border: 1px solid #d9dfeb;
  border-radius: 8px;
  background: #fff;
  color: #0d2b6b;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.neo-table__pager button:hover:not(:disabled) { border-color: #0d2b6b; background: #f5f7fc; }
.neo-table__pager button[aria-current="page"] {
  background: #0d2b6b;
  border-color: #0d2b6b;
  color: #fff;
}
.neo-table--amber .neo-table__pager button[aria-current="page"] { background: #e8a020; border-color: #e8a020; color: #1b1300; }
.neo-table__pager button:disabled { opacity: 0.4; cursor: default; }
.neo-table__pager .neo-table__gap { padding: 0 0.25rem; align-self: center; }

/* Mobile: stacked cards */
@media (max-width: 640px) {
  .neo-table--stack .neo-table__scroll {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .neo-table--stack .neo-table thead { display: none; }
  .neo-table--stack .neo-table,
  .neo-table--stack .neo-table tbody,
  .neo-table--stack .neo-table tr,
  .neo-table--stack .neo-table td,
  .neo-table--stack .neo-table tbody th { display: block; width: 100%; box-sizing: border-box; }
  .neo-table--stack .neo-table tbody tr {
    margin-bottom: 0.85rem;
    border: 1px solid var(--nt-border);
    border-left: 4px solid var(--nt-highlight);
    border-radius: 12px;
    background: var(--nt-bg);
    overflow: hidden;
    box-shadow: 0 4px 14px -8px rgba(13, 43, 107, 0.2);
  }
  .neo-table--stack .neo-table tbody tr > * {
    display: grid;
    grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
    gap: 0.75rem;
    text-align: left !important;
    border-bottom: 1px solid var(--nt-border) !important;
    border-left: 0 !important;
    background: transparent !important;
  }
  .neo-table--stack .neo-table tbody tr > *:last-child { border-bottom: 0 !important; }
  .neo-table--stack .neo-table tbody tr > *::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--nt-muted);
  }
  .neo-table--stack .neo-table tbody tr > :not([data-label]) { grid-template-columns: 1fr; }
  .neo-table--stack .neo-table tbody tr > :not([data-label])::before { display: none; }
  .neo-table--stack .neo-table tbody th { background: var(--nt-stripe) !important; }
  .neo-table--stack .neo-table__empty td { display: block; grid-template-columns: 1fr; }
  .neo-table--stack .neo-table__empty td::before { display: none; }

  .neo-table__search { max-width: none; }
  .neo-table__footer { justify-content: center; }
}

/* Icons inside cells ({icon:name}); mask shapes come from inline CSS generated in PHP */
.neo-table-wrap .nt-icon { width: 1.2em; height: 1.2em; }
.neo-table-wrap thead .nt-icon { width: 1.1em; height: 1.1em; vertical-align: -0.18em; }

/* Coloured text (<span class="nt-c-…">) also recolours links inside it */
.neo-table-wrap .neo-table [class*="nt-c-"] a { color: inherit; }
