/* ==========================================================================
   myid — application design system (tenant: Alpha)
   Layered over Tabler 1.4. Operate-mode investigative console.
   Anchor accent: Alpha #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;

  /* Alpha 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);
}
.nav-section-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--tblr-secondary); font-weight: 600;
  padding: .9rem 1.2rem .3rem;
}

/* 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; }
.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: 1rem; }
.section-head { display: flex; align-items: center; gap: .6rem; }
.section-head .ti { color: var(--tblr-secondary); font-size: 1.05rem; }
.section-count { 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; }

/* 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; }
