/* ==========================================================================
   application design system
   Layered over Tabler 1.4. Operate-mode investigative console.
   Anchor accent: #1f6feb. Single UI face: Inter. Light + dark.
   ========================================================================== */

/* ---- Inter (self-hosted, variable) ------------------------------------- */
@font-face {
  font-family: 'InterVar';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/vendor/fonts/inter-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'InterVar';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/vendor/fonts/inter-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* ---- Brand tokens ------------------------------------------------------- */
:root {
  --tblr-font-sans-serif: 'InterVar', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --app-font-mono: ui-monospace, 'SFMono-Regular', 'SF Mono', 'Cascadia Code', 'Roboto Mono', Menlo, Consolas, monospace;

  /* Anchor accent */
  --tblr-primary: #1f6feb;
  --tblr-primary-rgb: 31, 111, 235;
  --app-accent: #1f6feb;
  --app-accent-strong: #1a5fd0;
  --app-accent-soft: rgba(31, 111, 235, .10);
  --app-accent-line: rgba(31, 111, 235, .28);

  /* Radii — a touch softer than stock Tabler for a modern console feel */
  --tblr-border-radius: 7px;
  --tblr-border-radius-sm: 5px;
  --tblr-border-radius-lg: 11px;

  --app-font-feature: "cv05" 1, "ss01" 1, "cv01" 1;
  letter-spacing: 0;

  /* Secondary/muted text raised to ≥4.5:1 on the light ground (was too faint). */
  --tblr-secondary: #54617a;
  --tblr-secondary-color: #54617a;
}
::placeholder { color: #6a7688; opacity: 1; }

html { font-feature-settings: "cv05" 1, "ss01" 1; }

body {
  font-family: var(--tblr-font-sans-serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Numerals: every datum reads as tabular. */
.datagrid-content, .table, .table td, .table th,
.data-value, .kv-value, .stamp, .metric-value { font-variant-numeric: tabular-nums; }

/* ---- Page ground -------------------------------------------------------- */
:root {
  --tblr-body-bg: #f4f6fb;
}
[data-bs-theme="dark"] {
  --tblr-body-bg: #0c1119;
  --tblr-bg-surface: #131a25;
  --tblr-border-color: rgba(255,255,255,.08);
  --tblr-secondary: #9aa6ba;
  --tblr-secondary-color: #9aa6ba;
}
[data-bs-theme="dark"] ::placeholder { color: #8b98ac; }

/* Text selection + caret carry the accent (browser-surface theming). */
::selection { background: var(--app-accent-soft); color: inherit; }
:root { caret-color: var(--app-accent); }
:focus-visible { outline-color: var(--app-accent); }

/* Scrollbar — quiet, themed. */
* { scrollbar-width: thin; scrollbar-color: rgba(120,130,150,.45) transparent; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: rgba(120,130,150,.4); border-radius: 9px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(120,130,150,.62); background-clip: content-box; }

/* ==========================================================================
   App shell
   ========================================================================== */
.navbar-brand-lockup { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.navbar-brand-lockup:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(150deg, #2b7bff 0%, #1450b8 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 2px 6px rgba(20,80,184,.35);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-word { font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; line-height: 1; color: var(--tblr-body-color); }
.brand-word b { color: var(--app-accent); font-weight: 800; }

/* Sidebar nav polish: active item gets an accent rail, not a heavy fill. */
.navbar-vertical .nav-item .nav-link { border-radius: 8px; margin: 1px .5rem; font-weight: 500; }
.navbar-vertical .nav-item .nav-link .nav-link-icon { opacity: .74; }
.navbar-vertical .nav-item .nav-link:hover { background: var(--tblr-active-bg, rgba(120,130,150,.10)); }
.navbar-vertical .nav-item .nav-link.active,
.navbar-vertical .nav-item .nav-link[aria-current] {
  background: var(--app-accent-soft); color: var(--app-accent-strong);
  position: relative;
}
[data-bs-theme="dark"] .navbar-vertical .nav-item .nav-link.active { color: #9cc0ff; }
.navbar-vertical .nav-item .nav-link.active .nav-link-icon { opacity: 1; }
.navbar-vertical .nav-item .nav-link.active::before {
  content: ""; position: absolute; left: -.5rem; top: 50%; transform: translateY(-50%);
  width: 3px; height: 1.15rem; border-radius: 0 3px 3px 0; background: var(--app-accent);
}
/* Tabler lets each vertical .navbar-nav flex-grow, which spreads spare sidebar
   height between the groups as uneven gaps. Groups keep their natural height;
   the section labels own the rhythm (more air above a label than below it). */
.navbar-vertical .navbar-collapse .navbar-nav { flex-grow: 0; }
.nav-section-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--tblr-secondary); font-weight: 600;
  padding: 1.5rem 1.2rem .4rem;
}
.navbar-collapse > .nav-section-label:first-child { padding-top: .75rem; }

/* Theme toggle button */
.theme-toggle .ti-moon, .theme-toggle .ti-sun { font-size: 1.15rem; }
[data-bs-theme="light"] .theme-toggle .ti-sun,
:root:not([data-bs-theme="dark"]) .theme-toggle .ti-sun { display: none; }
[data-bs-theme="dark"] .theme-toggle .ti-moon { display: none; }

/* ==========================================================================
   Identifiers & data values
   ========================================================================== */
.identifier {
  font-family: var(--app-font-mono); font-variant-numeric: tabular-nums;
  letter-spacing: .01em; font-size: .92em; white-space: nowrap;
}
.identifier-lg { font-size: 1.02rem; font-weight: 600; }
.identifier-wrap { white-space: normal; overflow-wrap: anywhere; }
.copy-id { cursor: pointer; border: 0; background: transparent; padding: 0 0 0 .3rem; color: var(--tblr-secondary); line-height: 1; vertical-align: baseline; }
.copy-id:hover { color: var(--app-accent); }
.copy-id.is-copied { color: var(--tblr-success); }

.data-empty { color: var(--tblr-secondary); font-style: normal; }
.data-empty::before { content: "—"; }

/* Tabler datagrid, tuned for record read-out */
.datagrid { --tblr-datagrid-item-width: 15rem; gap: 1.15rem 2.25rem; }
.datagrid-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tblr-secondary); font-weight: 600; margin-bottom: .12rem; }
.datagrid-content { font-size: .95rem; color: var(--tblr-body-color); line-height: 1.35; }

/* ==========================================================================
   Profile hero (NRIC 360°)
   ========================================================================== */
.profile-hero { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.profile-portrait {
  width: 116px; height: 148px; flex: none; border-radius: 12px; overflow: hidden;
  background: color-mix(in srgb, var(--tblr-secondary) 9%, transparent);
  border: 1px solid var(--tblr-border-color);
  display: grid; place-items: center; color: var(--tblr-secondary);
}
.profile-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-hero-main { flex: 1 1 20rem; min-width: 0; }
.profile-name { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin: 0; }
.profile-idline { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin-top: .5rem; }

/* ==========================================================================
   Aggregation tabs
   ========================================================================== */
.profile-tabs__nav { position: sticky; top: 0; z-index: 5; }
.section-card + .section-card { margin-top: 2rem; }
.section-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .6rem; }
.section-head__title { margin: 0; font-size: .95rem; font-weight: 600; }
.section-count { font-size: .8rem; color: var(--tblr-secondary); font-variant-numeric: tabular-nums; }

/* Loading skeleton for lazy sections */
.skeleton-rows { display: grid; gap: .6rem; }
.skeleton-line { height: .82rem; border-radius: 5px; background: linear-gradient(90deg, rgba(130,140,160,.12) 25%, rgba(130,140,160,.22) 37%, rgba(130,140,160,.12) 63%); background-size: 400% 100%; animation: sk 1.25s ease-in-out infinite; }
.skeleton-line.w-60 { width: 60%; } .skeleton-line.w-40 { width: 40%; } .skeleton-line.w-80 { width: 80%; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton-line { animation: none; } }

/* Empty / failed section states */
.section-state { display: flex; align-items: center; gap: .6rem; padding: .85rem 0; color: var(--tblr-secondary); font-size: .9rem; }
.section-state .ti { font-size: 1.1rem; opacity: .7; }
.section-state.is-failed { color: #b45309; }
[data-bs-theme="dark"] .section-state.is-failed { color: #fbbf24; }

/* Documents (Media tab): inline image thumbnails + non-image download tiles */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.doc-thumb { margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.doc-thumb__frame { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1 / 1; padding: 0; overflow: hidden; border: 1px solid var(--tblr-border-color); border-radius: var(--tblr-border-radius); background: var(--tblr-bg-surface-secondary, rgba(130,140,160,.08)); cursor: pointer; }
.doc-thumb__frame:hover { border-color: var(--tblr-primary); }
.doc-thumb.is-failed .doc-thumb__frame { cursor: default; flex-direction: column; gap: .3rem; color: var(--tblr-secondary); }
.doc-thumb__frame:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: 2px; }
.doc-thumb__skel { width: 70%; height: 60%; border-radius: 5px; }
.doc-thumb__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-thumb__failicon { font-size: 1.6rem; opacity: .6; }
.doc-thumb__failtext { font-size: .72rem; }
.doc-thumb__cap { font-size: .74rem; color: var(--tblr-secondary); max-width: 100%; }

.doc-lightbox { position: fixed; inset: 0; z-index: 1080; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.doc-lightbox[hidden] { display: none; }
.doc-lightbox__backdrop { position: absolute; inset: 0; background: rgba(15, 20, 30, .78); }
.doc-lightbox__panel { position: relative; display: flex; flex-direction: column; gap: .6rem; max-width: min(960px, 100%); max-height: 100%; }
.doc-lightbox__bar { display: flex; align-items: center; gap: .75rem; color: #fff; }
.doc-lightbox__name { flex: 1 1 auto; min-width: 0; font-size: .9rem; }
.doc-lightbox__actions { flex: none; display: inline-flex; gap: .4rem; }
.doc-lightbox__stage { display: flex; align-items: center; justify-content: center; overflow: auto; }
.doc-lightbox__stage img { max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: var(--tblr-border-radius); background: #fff; }

/* Record mini-cards (vehicles, companies, party, etc.) */
.record-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); gap: .85rem; }
.record-tile { border-radius: 10px; padding: .9rem 1.05rem; background: color-mix(in srgb, var(--tblr-secondary) 6%, transparent); }
.record-tile__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .4rem .6rem; margin-bottom: .7rem; }
.record-tile__title { font-weight: 650; font-size: .98rem; letter-spacing: -.01em; min-width: 0; overflow-wrap: anywhere; }
.record-tile__head .badge { flex: none; }
.record-kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; font-size: .875rem; align-items: baseline; }
.record-kv dt { color: var(--tblr-secondary); font-weight: 500; white-space: nowrap; }
.record-kv dd { margin: 0; color: var(--tblr-body-color); min-width: 0; overflow-wrap: anywhere; }

/* OSINT tab — public records read-out (source-neutral by design). */
.osint-record + .osint-record { margin-top: 1.35rem; padding-top: 1.35rem; border-top: 1px solid var(--tblr-border-color); }
.osint-record__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .5rem .9rem; }
.osint-record__identity { min-width: 0; }
.osint-record__name { font-size: 1.02rem; font-weight: 650; letter-spacing: -.01em; margin: 0; overflow-wrap: anywhere; }
.osint-record__id { display: inline-block; margin-top: .2rem; font-size: .82rem; color: var(--tblr-secondary); }
.osint-record__badges { display: flex; flex-wrap: wrap; gap: .35rem; flex: none; }
.osint-photo { margin: 0; flex: none; }
.osint-photo__frame {
  width: 76px; height: 76px; padding: 0; overflow: hidden; cursor: pointer;
  border: 1px solid var(--tblr-border-color); border-radius: 10px;
  background: color-mix(in srgb, var(--tblr-secondary) 8%, transparent);
  display: grid; place-items: center;
}
.osint-photo__frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.osint-photo__frame:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: 2px; }
.osint-photo__skel { width: 70%; height: 70%; }
.osint-photo.is-failed .osint-photo__frame { cursor: default; color: var(--tblr-secondary); }
.osint-photo__fail { display: flex; flex-direction: column; align-items: center; gap: .15rem; font-size: .68rem; }
.osint-record__facts { margin-top: .9rem; }
.osint-cases { margin-top: 1.1rem; }
.osint-cases__title { font-size: .82rem; font-weight: 600; color: var(--tblr-secondary); margin: 0 0 .2rem; }
.osint-case { padding: .75rem 0; border-top: 1px solid var(--tblr-border-color); }
.osint-case:first-of-type { border-top: 0; padding-top: .2rem; }
.osint-case__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .75rem; }
.osint-case__no { font-size: .875rem; font-weight: 600; }
.osint-case__facts { margin-top: .4rem; }
.osint-case__details { margin-top: .45rem; }
.osint-case__details summary { cursor: pointer; color: var(--tblr-secondary); font-size: .82rem; }
.osint-case__details summary:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: 2px; }
.osint-case__details p { margin: .4rem 0 0; font-size: .875rem; line-height: 1.55; color: var(--tblr-body-color); }
.osint-pre { white-space: pre-line; }
@media (max-width: 575.98px) {
  .osint-record__facts, .osint-case__facts { grid-template-columns: 1fr; gap: .12rem .35rem; }
  .osint-record__facts dt, .osint-case__facts dt { margin-top: .35rem; }
  .osint-record__facts dt:first-of-type, .osint-case__facts dt:first-of-type { margin-top: 0; }
}

/* Relationship (person→person) list rows with pivot */
.entity-row { display: flex; align-items: center; gap: .85rem; padding: .7rem .25rem; border-top: 1px solid var(--tblr-border-color); }
.entity-row:first-child { border-top: 0; }
.entity-row__main { min-width: 0; flex: 1 1 auto; }
.entity-row__name { font-weight: 600; }
.entity-row__meta { color: var(--tblr-secondary); font-size: .82rem; display: flex; gap: .3rem .8rem; flex-wrap: wrap; margin-top: .1rem; }

/* ==========================================================================
   Search command bar (dashboard + lookup headers)
   ========================================================================== */
.search-command .form-control-lg, .search-command .form-select-lg { font-size: 1rem; }
.search-command .btn-lg { font-weight: 600; }
/* Name search: the birth-year field is fixed-width only once the command bar
   folds onto one line; below lg it fills its column like the name field. */
.filter-year { width: 7.5rem; }
@media (max-width: 991.98px) { .filter-year { width: 100%; } }

.feature-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; color: var(--app-accent); background: var(--app-accent-soft); font-size: 1.35rem; flex: none; }

/* Result meta / audit stamp bar */
.result-meta { display: flex; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--tblr-secondary); }
.audit-stamp { display: inline-flex; align-items: center; gap: .35rem; }
.audit-stamp .ti { font-size: .95rem; color: var(--tblr-success); }

/* Blur note for portraits */
.blur-note { font-size: .72rem; color: var(--tblr-secondary); display: inline-flex; align-items: center; gap: .28rem; margin-top: .35rem; }

/* Big empty state (no results yet / not found) */
.zero-state { text-align: center; padding: 2.6rem 1rem; max-width: 30rem; margin-inline: auto; }
.zero-state__icon { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 1rem; font-size: 1.9rem; color: var(--tblr-secondary); background: rgba(120,130,150,.10); }
.zero-state h2, .zero-state h3 { font-weight: 650; font-size: 1.2rem; margin-bottom: .35rem; }
.zero-state p { color: var(--tblr-secondary); }

/* Horizontal-scroll hint on the profile tab strip (8 tabs overflow on mobile). */
.profile-tabs__nav { -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent); }
.profile-tabs__nav::-webkit-scrollbar { height: 0; }

/* Utility */
.tnum { font-variant-numeric: tabular-nums; }
.text-wrap-anywhere { overflow-wrap: anywhere; }
.min-w-0 { min-width: 0; }


/* Journey (/coba/journey): a linked timeline list beside a self-hosted map.
   The list is server-rendered (every day present) and works without script;
   journey-map.js adds `.is-js`, the scope switch and the map. */
.jr-time { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.jr-time__sep { color: var(--tblr-secondary); font-weight: 400; margin-inline: .3rem; }
.jr-time__none { color: var(--tblr-secondary); font-weight: 400; }
.data-key { margin-bottom: 0; }
.data-key summary { cursor: pointer; color: var(--tblr-secondary); font-size: .82rem; }
.data-key dl { margin: .55rem 0 0; display: grid; grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr); gap: .2rem .9rem; font-size: .82rem; max-width: 52rem; }
.data-key dt { color: var(--tblr-secondary); font-weight: 600; }
.data-key dd { margin: 0; color: var(--tblr-body-color); }

@media (max-width: 575.98px) {
  .data-key dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .data-key dt { margin-top: .4rem; }
}


.jmap { --jmap-h: 680px; }
.jmap.is-js { display: grid; grid-template-columns: minmax(20rem, 26rem) minmax(0, 1fr); gap: 1rem; align-items: start; }
.jmap__list { overflow: hidden; margin: 0; }
.jmap-bar { display: grid; gap: .65rem; padding: .85rem 1rem; border-bottom: 1px solid var(--tblr-border-color-translucent); }
.jmap-bar[hidden], .jmap-nav[hidden], .jmap__map[hidden] { display: none; }
.jmap-nav { display: flex; align-items: center; gap: .5rem; }
.jmap-nav__label { flex: 1 1 auto; text-align: center; font-weight: 650; }
.jmap.is-js .jmap__scroll { max-height: var(--jmap-h); overflow-y: auto; overscroll-behavior: contain; }
.jmap.is-js .jmap-day[hidden] { display: none; }

.jmap-day + .jmap-day { border-top: 1px solid var(--tblr-border-color-translucent); }
.jmap-day__head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; padding: 1rem 1rem .4rem; }
.jmap-day__title { font-size: .9rem; font-weight: 650; margin: 0; }
.jmap-day__sum { font-size: .78rem; color: var(--tblr-secondary); }
.jmap.is-js[data-scope="day"] .jmap-day__title { display: none; }
.jmap-day__rows { list-style: none; margin: 0; padding: 0 0 .5rem; }

.jmap-row, .jmap-gap { position: relative; }
.jmap-row__btn { display: grid; align-items: stretch; grid-template-columns: 3.25rem 1.5rem minmax(0, 1fr); width: 100%; padding: 0 1rem; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: default; }
.jmap.is-js .jmap-row__btn { cursor: pointer; }
.jmap.is-js .jmap-row__btn:hover, .jmap-row.is-on .jmap-row__btn { background: var(--tblr-bg-surface-tertiary); }
.jmap-row__btn:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: -2px; }
.jmap-row__time { display: flex; flex-direction: column; font-size: .8rem; padding-top: .7rem; line-height: 1.35; }
.jmap-row__time .jr-time__sep { display: none; }
.jmap-row__time > :last-child { color: var(--tblr-secondary); font-weight: 400; }
.jmap-row__rail, .jmap-gap__rail { position: relative; align-self: stretch; }
.jmap-row__rail::before, .jmap-gap__rail::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--tblr-border-color-dark, var(--tblr-border-color)); }
.jmap-row:first-child .jmap-row__rail::before { top: 1rem; }
.jmap-row:last-child .jmap-row__rail::before { bottom: auto; height: 1rem; }
.jmap-gap__rail::before { background: none; width: 0; border-left: 2px dotted var(--tblr-border-color-dark, var(--tblr-border-color)); }
.jmap-row__rail i { position: absolute; left: 50%; top: .8rem; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%; background: var(--tblr-bg-surface); border: 2px solid var(--tblr-primary); }
.jmap-row.is-on .jmap-row__rail i { background: var(--tblr-primary); }
.jmap-row__body { display: flex; flex-direction: column; gap: .15rem; padding: .6rem 0 .6rem .5rem; min-width: 0; }
.jmap-row__route { font-weight: 600; font-size: .875rem; overflow-wrap: anywhere; }
.jmap-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; font-size: .78rem; color: var(--tblr-secondary); }
.jmap-row__dur { color: var(--tblr-body-color); }
/* Journey photos: a quiet icon toggle on the row's right edge and, when opened, a strip of two
   camera views under the row's content column (lane 16:9 beside front ~5:4, so both stand the same height). */
.jmap-row__photos-btn { position: absolute; top: .3rem; right: .75rem; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: var(--tblr-border-radius); background: none; color: var(--tblr-secondary); font-size: 1.05rem; cursor: pointer; }
.jmap-row__photos-btn[hidden] { display: none; }
.jmap-row__photos-btn:hover, .jmap-row__photos-btn.is-open { background: var(--tblr-bg-surface-secondary); color: var(--tblr-body-color); }
.jmap-row__photos-btn:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: 1px; }
.jmap-row.has-photos .jmap-row__body { padding-right: 2.5rem; }
.jmap-photos { margin: 0 1rem .75rem 6.25rem; container-type: inline-size; }
.jmap-photos[hidden] { display: none; }
.jmap-photos__inner { display: flex; flex-direction: column; gap: .6rem; padding-top: .15rem; }
.jmap-photos__switch { align-self: flex-start; }
/* Thumbnails, not full frames: the lightbox is where a photo is read. Column
   widths are in the two aspect ratios (16:9 vs 5:4 → 16 : 11.25) so both frames
   share one height and the captions line up. */
.jmap-photos__grid { display: grid; grid-template-columns: minmax(0, 16fr) minmax(0, 11.25fr); gap: .6rem; align-items: start; max-width: 28rem; }
.jmap-photo { margin: 0; min-width: 0; }
.jmap-photo__frame { display: block; width: 100%; padding: 0; border: 1px solid var(--tblr-border-color-translucent); border-radius: 8px; overflow: hidden; background: var(--tblr-bg-surface-secondary); color: var(--tblr-secondary); cursor: default; }
.jmap-photo--lane .jmap-photo__frame { aspect-ratio: 16 / 9; }
.jmap-photo--front .jmap-photo__frame { aspect-ratio: 5 / 4; }
.jmap-photo__frame.is-loaded { cursor: zoom-in; }
.jmap-photo__frame.is-loaded:hover { border-color: var(--tblr-border-color-dark, var(--tblr-border-color)); }
.jmap-photo__frame:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: 2px; }
.jmap-photo__frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.jmap-photo__fail { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; height: 100%; padding: .5rem; font-size: .75rem; text-align: center; }
.jmap-photo__cap { margin-top: .25rem; font-size: .72rem; color: var(--tblr-secondary); }
@media (max-width: 575.98px) {
  .jmap-photos { margin-left: 1rem; }
  .jmap-row__photos-btn { width: 2.5rem; height: 2.5rem; top: .2rem; }
}

.jmap-gap { display: grid; grid-template-columns: 3.25rem 1.5rem minmax(0, 1fr); padding: 0 1rem; font-size: .75rem; color: var(--tblr-secondary); font-variant-numeric: tabular-nums; }
.jmap-gap__text { grid-column: 3; padding: .2rem 0 .2rem .5rem; }

.jmap__map { position: sticky; top: 1rem; margin: 0; overflow: hidden; }
.jmap__canvas { height: var(--jmap-h); background: var(--tblr-bg-surface-tertiary); }
.jmap__fail { display: grid; place-items: center; height: var(--jmap-h); color: var(--tblr-secondary); }
.jmap-key { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; padding: .65rem 1rem; border-top: 1px solid var(--tblr-border-color-translucent); font-size: .75rem; color: var(--tblr-secondary); }
.jmap-key__item { display: inline-flex; align-items: center; gap: .4rem; }
.jmap-key__attr { margin-inline-start: auto; }
.jmap-key__line { display: inline-block; width: 1.25rem; height: 3px; border-radius: 2px; background: var(--tblr-primary); }
.jmap-key__line--other { height: 2px; opacity: .4; }
.jmap-key__ring { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--tblr-primary); opacity: .45; }
.jmap-key__ring--open { border-style: dashed; opacity: 1; }
[data-bs-theme="dark"] .jmap .maplibregl-ctrl-group { background: var(--tblr-bg-surface-secondary); }
[data-bs-theme="dark"] .jmap .maplibregl-ctrl-group button + button { border-top-color: var(--tblr-border-color); }
[data-bs-theme="dark"] .jmap .maplibregl-ctrl-icon { filter: invert(1); }

@media (max-width: 991.98px) {
  .jmap { --jmap-h: 340px; }
  .jmap.is-js { grid-template-columns: minmax(0, 1fr); }
  .jmap.is-js .jmap__map { position: relative; top: 0; order: -1; }
  .jmap.is-js .jmap__scroll { max-height: none; }
  .jmap-row__body { padding-block: .75rem; }
  .jmap-row__time { padding-top: .85rem; }
  .jmap-row__rail i { top: .95rem; }
  .jmap-row:first-child .jmap-row__rail::before { top: 1.15rem; }
  .jmap-row:last-child .jmap-row__rail::before { height: 1.15rem; }
  .jmap-nav .btn-icon { min-width: 2.75rem; min-height: 2.75rem; }
  .jmap-bar .btn { min-height: 2.5rem; }
}

@media print {
  .jmap, .jmap.is-js { display: block; }
  .jmap-bar, .jmap__map { display: none !important; }
  .jmap .jmap-day[hidden] { display: block !important; }
  .jmap .jmap-day__title { display: block !important; }
  .jmap.is-js .jmap__scroll { max-height: none; overflow: visible; }
  .jmap-row, .jmap-gap { break-inside: avoid; }
  .jmap-photos, .jmap-row__photos-btn { display: none !important; }
}

.is-busy { position: relative; color: transparent !important; }
.is-busy::after { content: ""; position: absolute; top: 50%; left: 50%; width: 1rem; height: 1rem; margin: -.5rem 0 0 -.5rem; border: 2px solid rgba(255,255,255,.55); border-right-color: transparent; border-radius: 50%; animation: app-spin .7s linear infinite; }
.btn-outline-secondary.is-busy::after, .btn-outline-primary.is-busy::after { border-color: var(--tblr-secondary); border-right-color: transparent; }
@keyframes app-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { .is-busy::after { animation-duration: 2s; } }

/* ==========================================================================
   Admin · Users
   Each user is a <tbody>: the facts row plus a collapsed "Manage" row, so the
   panel reads as part of its user and table striping/hover stay per user.
   ========================================================================== */
.users-table > .users-item + .users-item { border-top: 1px solid var(--tblr-border-color); }
.users-table > .users-item > tr:first-child > td { border-bottom: 0; }
.users-item.is-disabled > tr:first-child .fw-medium { color: var(--tblr-secondary); }
.users-you { margin-left: .5rem; font-size: .75rem; color: var(--tblr-secondary); }
.users-manage-btn .ti-chevron-down { transition: transform .18s cubic-bezier(.2, .7, .2, 1); }
.users-manage-btn[aria-expanded="true"] { color: var(--tblr-body-color); background: var(--tblr-bg-surface-secondary); }
.users-manage-btn[aria-expanded="true"] .ti-chevron-down { transform: rotate(180deg); }
.users-manage.collapsing { transition: none; }
.users-manage > td { padding: .25rem 1.25rem 1.25rem; border-bottom: 0; }
.users-manage__grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, auto)); justify-content: start;
  gap: 1rem 3rem; padding: 1rem 1.25rem; border-radius: 8px;
  background: var(--tblr-bg-surface-secondary);
}
.users-manage__title { margin: 0 0 .5rem; font-size: .8rem; font-weight: 600; color: var(--tblr-secondary); }
.users-manage__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.users-manage__footer { display: flex; justify-content: flex-end; padding: .5rem 0 0; }
.users-quota-input { width: 6.5rem; }
.users-new { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.5rem; }
.users-new__field { min-width: 12rem; }
.users-new__field--check { min-width: 0; padding-bottom: .55rem; }
.users-new__actions { display: flex; gap: .5rem; }
@media (max-width: 1199.98px) {
  .users-manage__grid { grid-template-columns: repeat(2, minmax(0, auto)); }
}
/* Phones: each user becomes a compact block (name + Manage, then one quiet line
   of facts) instead of a table that scrolls sideways. */
@media (max-width: 767.98px) {
  .users-table, .users-table > .users-item, .users-table tr, .users-table td { display: block; }
  .users-table > thead { display: none; }
  .users-table > .users-item > tr:first-child {
    display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .9rem; padding: .85rem 1rem;
  }
  .users-table > .users-item > tr:first-child > td { padding: 0; border: 0; white-space: normal; }
  /* name + Manage fill line one exactly, so the facts always start line two */
  .users-cell-name { order: 1; flex: 0 0 calc(100% - 7.4rem); min-width: 0; }
  .users-cell-manage { order: 2; flex: 0 0 6.5rem; }
  .users-cell-role, .users-cell-status, .users-cell-last, .users-cell-today {
    order: 3; font-size: .8rem; color: var(--tblr-secondary);
  }
  .users-cell-last::before, .users-cell-today::before { content: attr(data-label) " "; }
  .users-manage > td { padding: 0 .75rem 1rem; }
  .users-manage__grid { grid-template-columns: minmax(0, 1fr); padding: 1rem; }
}

/* ==========================================================================
   Admin · API tokens (reuses the Users table/manage pattern; everything here is
   scoped to .token-* / .tokens-table so the Users page is untouched)
   ========================================================================== */
.token-secret__row { display: flex; gap: .5rem; align-items: stretch; }
.token-secret__value {
  flex: 1 1 auto; min-width: 0; min-height: 2.5rem;
  font-family: var(--app-font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; overflow-x: auto;
}
.token-secret__copy { flex: none; min-height: 2.5rem; min-width: 6.5rem; }
.token-secret__note { margin: .75rem 0 0; color: var(--tblr-secondary); font-size: .875rem; }
.token-secret__status { margin: .25rem 0 0; font-size: .875rem; color: var(--tblr-body-color); }
.token-secret__status:empty, .token-secret__status.is-quiet { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }
.tokens-soon { margin-top: .15rem; padding-left: 1.1rem; font-size: .8rem; color: var(--tblr-secondary); }
/* Create + edit share one grid: two columns from md up, one below. */
.token-form { max-width: 54rem; }
.token-form__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem 2.5rem; }
@media (min-width: 768px) {
  .token-form__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .token-form__field--wide { grid-column: 1 / -1; }
}
.token-form__field { min-width: 0; margin: 0; padding: 0; border: 0; }
.token-form__field > legend { float: none; width: auto; margin-bottom: .5rem; padding: 0; }
.token-form__optional { margin-left: .25rem; font-weight: 400; color: var(--tblr-secondary); }
.token-form__mono { font-family: var(--app-font-mono); font-variant-numeric: tabular-nums; }
.token-form__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }
.token-choice { display: flex; align-items: center; gap: .6rem; min-height: 2.5rem; }
.token-choice > .form-check-input { flex: none; margin: 0; }
.token-choice__label { cursor: pointer; }
.token-choice__input { width: 7.5rem; }
.token-choice__input--date { width: 11.5rem; }
.token-choice__suffix { color: var(--tblr-secondary); }
.token-choice__input.is-invalid { padding-right: .75rem; background-image: none; }
.token-form .invalid-feedback { margin-top: .4rem; font-size: .875rem; }
.token-form .invalid-feedback + .form-hint { margin-top: .25rem; }
/* Edit panel: the form, then a quiet row for status, revoke and activity. */
.token-manage { max-width: 57rem; padding: 1.25rem 1.5rem; border-radius: 8px; background: var(--tblr-bg-surface-secondary); }
.token-manage .token-form { max-width: none; }
.token-manage .form-control:not(:disabled) { background-color: var(--tblr-bg-surface); }
.token-manage__more {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--tblr-border-color);
}
.token-manage__status { display: flex; flex-wrap: wrap; gap: .5rem; }
/* Row actions: Activity sits beside Manage (revoked rows carry Activity alone). */
.tokens-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: .25rem; }
.token-changes { font-size: .875rem; }
.token-changes > div + div { margin-top: .15rem; }
/* The just-created token: a soft accent wash that fades once; static (until the
   next load) when motion is reduced. */
.tokens-table > .users-item.is-new > tr:first-child > td { background: var(--app-accent-soft); }
@media (prefers-reduced-motion: no-preference) {
  .tokens-table > .users-item.is-new > tr:first-child > td,
  .tokens-table > .users-item.is-new > tr:first-child { animation: token-new 2.4s cubic-bezier(.2, .7, .2, 1) 1.2s forwards; }
}
@keyframes token-new { to { background: transparent; } }

/* Phones: the token list reuses the Users block layout (remark + Manage on line
   one, labelled facts after); the activity tables stack each request into two
   lines (time · outcome, then endpoint · input · IP) so outcome and IP never
   scroll sideways. */
@media (max-width: 767.98px) {
  /* two action buttons: let the remark take what is left of line one, and break
     before the facts so they still always start line two */
  .tokens-table .users-cell-name { flex: 1 1 0; }
  .tokens-table .users-cell-manage { flex: 0 0 auto; }
  .tokens-table > .users-item > tr:first-child::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
  .tokens-table .tokens-cell { order: 3; font-size: .8rem; color: var(--tblr-secondary); }
  .tokens-table .tokens-cell::before { content: attr(data-label) " "; }
  .tokens-table .tokens-cell code { padding: 0; background: none; font-size: inherit; }
  .tokens-table .tokens-cell--allow { display: flex; flex-wrap: wrap; column-gap: .3em; }
  .tokens-table .tokens-cell--allow > div:not(:last-child)::after { content: ","; }
  /* rows are blocks here: wash the whole row, not each fact */
  .tokens-table > .users-item.is-new > tr:first-child { background: var(--app-accent-soft); }
  .tokens-table > .users-item.is-new > tr:first-child > td { background: transparent; animation: none; }
  .tokens-table .tokens-soon { display: inline; margin: 0 0 0 .35rem; padding: 0; }
  .token-manage { padding: 1rem; }
  .token-manage__more .btn { min-height: 2.5rem; }
  .token-form__actions .btn-primary { flex: 1 1 auto; }

  .api-log, .api-log > tbody, .api-changes, .api-changes > tbody, .api-byip, .api-byip > tbody { display: block; }
  .api-log > thead, .api-changes > thead, .api-byip > thead { display: none; }
  .api-log > tbody > tr, .api-changes > tbody > tr, .api-byip > tbody > tr {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .5rem;
    padding: .7rem 1rem; border-bottom: 1px solid var(--tblr-border-color);
  }
  .api-log > tbody > tr:last-child, .api-changes > tbody > tr:last-child, .api-byip > tbody > tr:last-child { border-bottom: 0; }
  .table.api-log > tbody > tr > td, .table.api-changes > tbody > tr > td, .table.api-byip > tbody > tr > td {
    display: block; padding: 0; border: 0; box-shadow: none; white-space: normal;
  }
  .api-log > tbody > tr::after, .api-changes > tbody > tr::after { content: ""; order: 4; flex-basis: 100%; height: 0; }
  .api-changes__time { order: 1; flex: 1 1 auto; }
  .api-changes__action { order: 2; }
  .api-changes__actor { order: 5; }
  .api-changes__ip { order: 6; }
  .api-changes__actor, .api-changes__ip { font-size: .8rem; color: var(--tblr-secondary); }
  .api-changes__ip::before { content: "· "; }
  .table.api-changes > tbody > tr > td.api-changes__details { order: 7; flex-basis: 100%; margin-top: .35rem; }
  .api-byip__ip { flex: 1 1 auto; }
  .api-byip__last { flex-basis: 100%; text-align: left !important; font-size: .8rem; color: var(--tblr-secondary); }
  .api-byip__last::before { content: attr(data-label) " "; }
  .api-log__time { order: 1; flex: 1 1 auto; }
  .api-log__outcome { order: 2; }
  .api-log__results { order: 3; font-size: .8rem; color: var(--tblr-secondary); }
  .api-log__results::before { content: "· "; }
  .api-log__results::after { content: " " attr(data-label); }
  .api-log__endpoint { order: 5; }
  .api-log__input { order: 6; }
  .api-log__ip { order: 7; }
  .api-log__endpoint, .api-log__input, .api-log__ip { font-size: .8rem; color: var(--tblr-secondary); overflow-wrap: anywhere; }
  .table.api-log > tbody > tr > td.api-log__input:empty { display: none; }
  .api-log__input::before, .api-log__ip::before { content: "· "; }
}

/* ==========================================================================
   Person (NRIC 360°): subject header, tab counts, profile details
   ========================================================================== */
.subject-head { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem .9rem; }
.subject-head__photo {
  flex: none; width: 3.5rem; height: 4.25rem; border-radius: 8px; overflow: hidden;
  display: grid; place-items: center; background: var(--tblr-bg-surface-secondary); color: var(--tblr-secondary); font-size: 1.6rem;
}
.subject-head__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.subject-head__main { min-width: 0; }
.subject-head__name { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; text-wrap: balance; }
.subject-head__line { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; margin-top: .3rem; color: var(--tblr-secondary); font-size: .875rem; }
.subject-head__line .identifier { color: var(--tblr-body-color); font-weight: 600; }
.subject-head__line .copy-id { margin-left: -.5rem; }
.profile-tabs__count { margin-left: .4rem; font-size: .75rem; font-variant-numeric: tabular-nums; color: var(--tblr-secondary); }
.profile-tabs .nav-link.active .profile-tabs__count { color: inherit; }
.profile-tabs .nav-link.is-empty { opacity: .55; }
.profile-tabs .nav-link.is-empty.active { opacity: 1; }
.profile-details { display: flex; flex-direction: column; gap: 1.75rem; }
.profile-details__title { margin: 0 0 .6rem; font-size: .8rem; font-weight: 600; color: var(--tblr-secondary); }
.profile-details__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr)); gap: .9rem 1.5rem; margin: 0; }
.profile-details__grid.is-wide { grid-template-columns: repeat(auto-fill, minmax(min(22rem, 100%), 1fr)); }
.profile-details__item dt { font-size: .75rem; font-weight: 500; color: var(--tblr-secondary); margin: 0 0 .1rem; }
.profile-details__item dd { margin: 0; }
.search-command.is-compact .input-icon .form-control { font-size: .95rem; }
@media (max-width: 575.98px) {
  .subject-head { padding: 1rem; }
  .subject-head__name { font-size: 1.15rem; }
}

/* ==========================================================================
   Phone (and other contact lookups): one entry per person
   ========================================================================== */
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-entry { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem 1.25rem; }
.contact-list > .contact-entry + .contact-entry { border-top: 1px solid var(--tblr-border-color); }
.contact-entry__main { flex: 1 1 auto; min-width: 0; }
.contact-entry__name { font-weight: 600; line-height: 1.3; }
.contact-entry__meta { display: flex; flex-wrap: wrap; gap: .15rem 1rem; margin-top: .2rem; font-size: .875rem; color: var(--tblr-secondary); }
.contact-entry__meta .identifier { color: var(--tblr-body-color); }
.contact-entry__details { list-style: none; margin: .45rem 0 0; padding: 0; font-size: .875rem; }
.contact-entry__details li + li { margin-top: .15rem; }
.contact-entry__action { flex: none; }
.contact-group { padding-top: .25rem; }
.contact-group.has-divider { border-top: 1px solid var(--tblr-border-color); padding-top: 1rem; }
.contact-group__title { margin: 0; padding: 0 1.25rem .25rem; font-size: .8rem; font-weight: 600; color: var(--tblr-secondary); }
.contact-list.is-quiet .contact-entry { padding-block: .7rem; }
.contact-list.is-quiet .contact-entry__name { font-weight: 500; }
@media (max-width: 575.98px) {
  .contact-entry { flex-direction: column; gap: .6rem; padding: .9rem 1rem; }
  .contact-entry__action .btn { width: 100%; }
  .contact-group__title { padding-inline: 1rem; }
}

/* Owner / subject row on single-record lookups (vehicle, company, electoral) */
.owner-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .85rem 1rem; margin-bottom: 1.25rem; border-radius: 8px; background: var(--tblr-bg-surface-secondary); }
.owner-row__main { display: flex; align-items: baseline; flex-wrap: wrap; gap: .1rem .9rem; min-width: 0; }
.owner-row__label { font-size: .8rem; font-weight: 600; color: var(--tblr-secondary); }
.owner-row__name { font-weight: 600; }
.owner-row__ic { font-size: .9rem; color: var(--tblr-secondary); }
.owner-row--inline { margin: .7rem 0 0; padding: .6rem .8rem; }
.record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.record-head__main { min-width: 0; }
.contact-entry__photo { flex: none; }
.result-heading { margin: 0 0 .6rem; font-size: .95rem; font-weight: 600; }
.result-more { margin-top: 1.75rem; }
.result-more > summary.result-heading { cursor: pointer; list-style-position: outside; margin-left: 1rem; }
.result-more > summary.result-heading::marker { color: var(--tblr-secondary); }
@media (max-width: 575.98px) { .contact-entry__photo { display: none; } }
