/* Apple-inspired web materials. Content stays opaque; KGMotion owns transforms.
   No SVG refraction, extra animation ticker, font download or WebGL is required. */
:root {
  --lg-ink: #202b3b;
  --lg-muted: #344257;
  --lg-accent: #294c6b;
  --lg-fill: rgba(255, 255, 255, .76);
  --lg-fill-strong: rgba(250, 252, 255, .94);
  --lg-card-fill: rgba(255, 255, 255, .86);
  --lg-sheen: rgba(255,255,255,.58);
  --lg-inset-fill: rgba(255,255,255,.72);
  --lg-inset-stroke: #dfe6ed;
  --lg-solid: #f8fafc;
  --lg-stroke: rgba(255, 255, 255, .88);
  --lg-stroke-low: rgba(69, 88, 113, .16);
  --lg-blur: 22px;
  --lg-material: linear-gradient(125deg, rgba(255,255,255,.55), rgba(255,255,255,0) 48%);
  --lg-rim: inset 0 1px 0 rgba(255,255,255,.96), inset 0 -1px 0 rgba(79,104,132,.07);
  --lg-elevation: 0 2px 5px rgba(27,43,63,.025), 0 12px 32px rgba(27,43,63,.065);
  --lg-overlay-shadow: 0 8px 24px rgba(16,32,52,.10), 0 32px 96px rgba(16,32,52,.22);
  --lg-duration: 220ms;
  --lg-ease: cubic-bezier(.22,1,.36,1);
  --lg-data-bg: #fff;
  --lg-data-ink: #202b3b;
  --lg-data-line: #dce3eb;
}
/* Tokens also support an explicitly selected dark chrome without recoloring data. */
:root[data-theme="dark"] {
  --lg-ink: #f4f7fc;
  --lg-muted: #d3ddec;
  --lg-fill: rgba(25, 38, 55, .90);
  --lg-fill-strong: rgba(25, 38, 55, .97);
  --lg-card-fill: rgba(25, 38, 55, .96);
  --lg-sheen: rgba(255,255,255,.08);
  --lg-inset-fill: #223249;
  --lg-inset-stroke: #415169;
  --lg-solid: #192637;
  --lg-stroke: rgba(232,241,255,.24);
  --lg-stroke-low: rgba(232,241,255,.16);
  --lg-material: linear-gradient(125deg, rgba(255,255,255,.08), transparent 48%);
  --lg-rim: inset 0 1px 0 rgba(255,255,255,.15), inset 0 -1px 0 rgba(0,0,0,.16);
}
body {
  background: radial-gradient(ellipse at 10% 0%, #dce5ef 0, transparent 52%),
    radial-gradient(ellipse at 100% 45%, #e8edf3 0, transparent 62%), #f1f3f6;
  background-attachment: fixed;
}
/* Chrome: a light-catching edge and an inner bevel over a quiet, frosted fill. */
body .shell > header,
body .sidebar,
body .masthead,
body .topbar,
body .modal,
body dialog,
body .registry-select fieldset,
body [popover],
body .dash-tabs,
body :is(.registry-filters, .shipment-filters, .client-filters, .tools) {
  background: var(--lg-material), var(--lg-fill);
  color: var(--lg-ink);
  border: 1px solid var(--lg-stroke);
  border-bottom-color: var(--lg-stroke-low);
  box-shadow: var(--lg-rim), var(--lg-elevation);
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(1.16);
  backdrop-filter: blur(var(--lg-blur)) saturate(1.16);
}
body .shell > header {
  border-radius: 24px;
  --lg-fill: rgba(255,255,255,.72);
}
body .sidebar { --lg-fill: rgba(248,251,255,.76); }
:root[data-theme="dark"] body .shell > header,
:root[data-theme="dark"] body .sidebar { --lg-fill: rgba(25,38,55,.90); }
body .sidebar :is(.workspace, .profile) { background: transparent; }
body .sidebar :is(.navlabel, nav a, .profile small, .workspace small),
body .shell > header :is(.breadcrumb, .global-search),
body .masthead .session { color: var(--lg-muted); }
body .shell > header .breadcrumb strong { color: var(--lg-ink); }
body .sidebar nav a { min-height: 42px; border-radius: 12px; }
body .sidebar nav a.active,
body .sidebar nav a:focus-visible {
  background: linear-gradient(180deg, #fff, #ecf1f7);
  color: #244462;
  box-shadow: inset 0 1px 0 #fff, 0 1px 4px #20374f12;
}
body .sidebar nav a svg { color: inherit; }
body .shell > header :is(kbd, .avatar),
body .sidebar .avatar { background: #e8eef5; color: #3b5069; }
body .shell > header .global-search { border-radius: 12px; }
body .masthead { position: sticky; top: 0; z-index: 10; }
@media (min-width:769px) {
  body .sidebar {
    inset: 12px auto 12px 12px;
    width: calc(var(--nav) - 12px);
    border-radius: 24px;
    height: calc(100dvh - 24px);
  }
}
/* The dashboard uses a denser frost. Charts and table data are painted on top. */
body :is(.dash-metric, .dash-block, .bento-card, .client-summary-card) {
  position: relative;
  min-width: 0;
  background: linear-gradient(125deg, var(--lg-sheen), transparent 58%), var(--lg-card-fill);
  border: 1px solid var(--lg-stroke);
  border-bottom-color: var(--lg-stroke-low);
  border-radius: 24px;
  box-shadow: var(--lg-rim), 0 2px 4px #20364f03, 0 10px 28px #20364f09;
  color: var(--lg-ink);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: border-color var(--lg-duration) var(--lg-ease), box-shadow var(--lg-duration) var(--lg-ease);
}
body :is(.dash-metric, .dash-block, .bento-card, .client-summary-card)::after {
  content: "";
  position: absolute;
  top: 0;
  inset-inline: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  opacity: .5;
  pointer-events: none;
  transition: opacity var(--lg-duration) ease-out;
}
body :is(.dash-metric span, .dash-metric small, .dash-block-head p, .dash-note, .dash-scope, .dash-ring-total span),
body .client-summary-card :is(span,small) { color: var(--lg-muted); }
body .client-summary-card:first-child,
body .bento-main,
body #dash-content[aria-labelledby="dash-tab-stock"] > .dash-metrics > .dash-metric:first-child {
  background: linear-gradient(125deg, var(--lg-sheen), transparent 65%), var(--lg-card-fill);
  color: var(--lg-ink);
  border-color: var(--lg-stroke);
}
body :is(.bento-main, .client-summary-card:first-child) :is(strong, h2) { color: var(--lg-ink); }
body #dash-content[aria-labelledby="dash-tab-stock"] > .dash-metrics > .dash-metric:first-child :is(strong,span,small) { color: var(--lg-ink); }
body .client-summary-card:first-child :is(span,small) { color: var(--lg-muted); }
body .dash-block .dash-metric { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: var(--lg-rim); }
body .dash-green strong { color: #20533b; }
body .dash-red strong, body .dash-note.dash-red { color: #8b302e; }
:root[data-theme="dark"] body .dash-green strong { color: #a2ddbf; }
:root[data-theme="dark"] body .dash-red strong,
:root[data-theme="dark"] body .dash-note.dash-red { color: #f1b3ae; }
/* Segmented navigation has its own quiet rail, instead of an underline tab. */
body .dash-tabs { width: fit-content; max-width: 100%; gap: 4px; padding: 5px; border-radius: 17px; }
body .dash-tabs button { border: 1px solid transparent; border-radius: 12px; font-weight: 500; color: var(--lg-muted); min-height: 44px; }
body .dash-tabs button[aria-selected="true"] { background: linear-gradient(180deg, #fff, #f5f8fb); border-color: #fff; color: #233f5a; box-shadow: 0 1px 4px #1c324d18; }
/* Dense data is a separate, opaque material. No row, cell or text is blurred. */
body :is(.panel, .client-grid, .registry-panel, .shipment-panel) { background: var(--lg-data-bg); border-color: var(--lg-data-line); }
body :is(.table-wrap, .registry-table-wrap, .shipment-table-wrap, .client-table-wrap, .dash-table),
body table {
  background: var(--lg-data-bg);
  color: var(--lg-data-ink);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  filter: none;
}
body table th { background: #f1f4f8; color: #3c4d62; border-color: var(--lg-data-line); }
body table td { background: var(--lg-data-bg); border-color: var(--lg-data-line); }
body .client-grid { overflow: hidden; }
body .client-tools { background: #f8fafc; }
body .client-filter-fields { background: transparent; }
body :is(.registry-filters, .shipment-filters) { position: relative; z-index: 4; border-radius: 24px 24px 0 0; }
body .tools { border-radius: 18px; }
body .registry-select fieldset { --lg-fill: rgba(255,255,255,.94); border-radius: 16px; box-shadow: var(--lg-rim), 0 16px 40px #152b4829; }
body .registry-select summary { background: #f9fbfd; border: 1px solid #c9d4e0; border-radius: 10px; }
/* Modal text is always opaque. The overlay blur is fixed, only opacity animates. */
body .overlay,
body dialog::backdrop {
  background: rgba(20,35,55,.30);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
body .modal,
body dialog {
  --lg-fill: var(--lg-fill-strong);
  border-radius: 28px;
  box-shadow: var(--lg-rim), var(--lg-overlay-shadow);
}
body .modal :is(p,small,dt,.field), body dialog :is(p,small,label) { color: var(--lg-muted); }
body .modal :is(input,select,textarea), body dialog :is(input,select,textarea) {
  background: #fff;
  color: var(--lg-data-ink);
  border-color: #becbd8;
}
body .modal :is(.passport-head,.client-detail-group,.spec) { background: var(--lg-inset-fill); border-color: var(--lg-inset-stroke); color: var(--lg-ink); box-shadow: none; }
body .modal :is(.passport-disclosure,.detail-aside,.timeline-item) { border-color: #d4dde7; }
body .modal .client-history { background: rgba(255,255,255,.55); border-color: #d4dde7; }
/* Small bevels belong to controls. The text remains solid at every state. */
body :is(.button, .iconbutton, .client-icon-button),
body.nfc-page .passport .action-list .button.nfc-action {
  background: linear-gradient(180deg, #fff 0%, #f4f7fa 100%);
  border: 1px solid #c8d3df;
  border-top-color: #e2e9f0;
  border-radius: 12px;
  color: #294661;
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px #21395108;
  transition: background-color var(--lg-duration) ease-out, border-color var(--lg-duration) ease-out, box-shadow var(--lg-duration) ease-out, color var(--lg-duration) ease-out;
}
body .button.primary,
body .client-tools .button.primary.client-add,
body.nfc-page .passport .action-list .button.nfc-action.primary,
body.nfc-page #operation-dialog .primary {
  background: linear-gradient(180deg, #365d7e 0%, #24425f 100%);
  border-color: #24425f;
  border-top-color: #6d8ba4;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.23), 0 2px 3px #19314a12, 0 5px 12px #19314a12;
}
body .button.danger, body .button.service-action { color: #87382f; }
body :is(.button,.iconbutton,.client-icon-button):disabled { box-shadow: none; cursor: not-allowed; }
body :is(button,a,summary,input,select,textarea):focus-visible { outline: 3px solid #315e88; outline-offset: 3px; }
body input::placeholder, body textarea::placeholder { color: #516176; opacity: 1; }
body.nfc-page .passport-records { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
body.nfc-page .passport .identity { box-shadow: inset 0 1px 0 #ffffff28, 0 10px 30px #213b5514; }
@media (hover:hover) and (pointer:fine) {
  body .sidebar nav a:hover { background: rgba(255,255,255,.84); color: #244462; }
  body :is(.dash-metric,.dash-block,.bento-card,.client-summary-card):hover {
    border-color: #fff;
    box-shadow: var(--lg-rim), 0 4px 10px #20364f06, 0 18px 40px #20364f16;
  }
  body :is(.dash-metric,.dash-block,.bento-card,.client-summary-card):hover::after { opacity: 1; }
  body :is(.button,.iconbutton,.client-icon-button):hover:not(:disabled) { border-color: #8eabc3; box-shadow: inset 0 1px 0 #fff, 0 0 0 3px #385e8410, 0 3px 10px #2139510d; }
  body .button.primary:hover:not(:disabled),
  body .client-tools .button.primary.client-add:hover:not(:disabled),
  body.nfc-page .passport .action-list .button.nfc-action.primary:hover:not(:disabled) { background: linear-gradient(180deg, #406b90, #2b4e70); border-color: #365d7e; color: #fff; box-shadow: inset 0 1px 0 #ffffff40, 0 0 0 3px #385e8416, 0 5px 16px #21395122; }
  body.nfc-page .passport .action-list .button.nfc-action:not(.primary):hover:not(:disabled) { background: #edf4fa; border-color: #8eabc3; }
  body tbody tr:hover > td { background: #eaf1f7; }
}
body .button:active:not(:disabled), body.nfc-page .passport .action-list .button.nfc-action:active:not(:disabled) { box-shadow: inset 0 2px 4px #162c4218; }
@supports (appearance:base-select) {
  select:not([multiple]), select:not([multiple])::picker(select) { appearance: base-select; }
  body select:not([multiple])::picker(select) { background: var(--lg-fill-strong); color: var(--lg-ink); border: 1px solid var(--lg-stroke); border-radius: 16px; padding: 8px; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: var(--lg-rim), 0 12px 32px #172b4526; }
  body select:not([multiple]) option { padding: 10px 12px; border-radius: 8px; }
  body select:not([multiple]) option:checked { background: #e3ecf4; color: #223e5b; }
}
@media (max-width:768px) {
  :root { --lg-blur: 16px; }
  body { background-attachment: scroll; }
  body .sidebar { left: 0; height: 100dvh; border-radius: 0 24px 24px 0; --lg-fill: rgba(250,252,255,.94); }
  body .shell > header { border-radius: 18px; }
  body .dash-tabs { width: 100%; border-radius: 16px; }
  body :is(.dash-metric,.dash-block,.bento-card,.client-summary-card) { border-radius: 20px; -webkit-backdrop-filter: none; backdrop-filter: none; }
  body .modal, body dialog { border-radius: 22px; }
  body .modal.large.detail-modal { border-radius: 22px; }
  body :is(.button,.iconbutton,.client-icon-button), body .sidebar nav a { min-height: 48px; }
  body .iconbutton { min-width: 48px; }
}
/* Solid fallback is shared by unsupported blur, accessibility and explicit settings. */
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) {
  :root, :root[data-theme="dark"] { --lg-fill: var(--lg-solid); --lg-card-fill: var(--lg-solid); --lg-fill-strong: var(--lg-solid); --lg-material: none; }
  body .shell > header, body .sidebar, body .registry-select fieldset { --lg-fill: var(--lg-solid) !important; }
  body .overlay, body dialog::backdrop { background: #1b2d4480; }
}
@media (prefers-reduced-transparency:reduce), (prefers-contrast:more) {
  :root, :root[data-theme="dark"] { --lg-fill: var(--lg-solid); --lg-card-fill: var(--lg-solid); --lg-fill-strong: var(--lg-solid); --lg-material: none; }
  body .shell > header, body .sidebar, body .registry-select fieldset { --lg-fill: var(--lg-solid) !important; }
  body *, body *::before, body *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  body :is(.dash-metric,.dash-block,.bento-card,.client-summary-card,.button,.iconbutton):hover,
  body .button:active, body.nfc-page .passport .action-list .button.nfc-action:active { transform: none !important; }
}
@media (forced-colors:active) {
  body .shell > header, body .sidebar, body .masthead, body .modal, body dialog,
  body :is(.dash-tabs,.dash-metric,.dash-block,.bento-card,.client-summary-card,.registry-filters,.shipment-filters,.client-filters,.tools),
  body .registry-select fieldset, body [popover], body :is(.button,.iconbutton), body table, body table :is(th,td) {
    background: Canvas !important; color: CanvasText !important; border-color: ButtonText !important;
    box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  }
  body :is(button,a,summary,input,select,textarea):focus-visible { outline-color: Highlight; }
}
/* Searchable substance multiselect: local Tom Select, styled as existing chrome. */
.registry-substance-filter { position: relative; flex: 0 1 250px; min-width: 0; max-width: 100%; color: #294661; }
.registry-substance-filter .ts-wrapper { margin: 0; padding: 0; }
.registry-substance-filter .ts-control,
.registry-substance-filter .ts-wrapper.multi.has-items .ts-control {
  min-height: 42px; padding: 8px 32px 8px 12px; border: 1px solid #c9d4e0;
  border-radius: 10px; background: #f9fbfd; color: #294661; box-shadow: inset 0 1px 0 #fff;
  font: inherit; cursor: pointer; align-items: center;
}
.registry-substance-filter .ts-control::before { content: attr(data-selection-label); pointer-events: none; font-size: 14px; font-weight: 500; }
.registry-substance-filter .ts-control::after { content: ''; position: absolute; right: 14px; top: 15px; width: 6px; height: 6px; border-right: 1px solid; border-bottom: 1px solid; transform: rotate(45deg); }
.registry-substance-filter .ts-control > :is(.item,.items-placeholder) { display: none !important; }
.registry-substance-filter .ts-control:focus-visible { outline: 3px solid #315e88; outline-offset: 3px; }
.registry-substance-filter .ts-wrapper.focus .ts-control { border-color: #7192af; }
.registry-substance-filter .ts-dropdown {
  margin-top: 6px; min-width: 100%; width: min(340px,calc(100vw - 48px)); z-index: 12;
  border: 1px solid var(--lg-stroke); border-bottom-color: var(--lg-stroke-low); border-radius: 16px;
  background: var(--lg-material), var(--lg-fill-strong); color: #293d53;
  box-shadow: var(--lg-rim), 0 16px 40px #152b4829;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); overflow: hidden;
  font: inherit;
}
.registry-substance-filter .dropdown-input-wrap { padding: 10px; border-bottom: 1px solid #dce4ec; }
.registry-substance-filter .dropdown-input {
  width: 100%; min-height: 44px; padding: 10px 12px; margin: 0; border: 1px solid #bfcddb;
  border-radius: 10px; color: #202b3b; background: #fff; font-size: 16px; box-shadow: none;
}
.registry-substance-filter .ts-dropdown-content { max-height: 260px; padding: 4px; }
.registry-substance-filter .ts-dropdown :is(.option,.no-results) { padding: 12px; min-height: 44px; line-height: 1.45; overflow-wrap: anywhere; }
.registry-substance-filter .ts-dropdown .option { border-radius: 8px; }
.registry-substance-filter .ts-dropdown .option.active { background: #e8f0f7; color: #203d5a; }
.registry-substance-filter .ts-dropdown .option.selected { background: #edf3f8; color: #203d5a; }
.registry-substance-filter .tomselect-checkbox { margin-right: 8px; accent-color: #294c6b; }
.registry-substance-filter .highlight { background: #cbddeb; border-radius: 2px; color: inherit; }
.registry-table { min-width: 1050px; width: 100%; }
.registry-gases { min-width: 140px; max-width: 230px; gap: 6px; }
.registry-gases span { padding: 5px 8px; border-radius: 8px; font-size: 13px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.registry-current .gas-confirmed { color: #285442; background: #edf5f0; border-color: #d0e1d7; }
.registry-current .gas-unconfirmed { color: #455569; background: #f1f4f7; border-color: #d5dee7; }
.registry-current .gas-mismatch { color: #87382f; background: #fbefed; border-color: #e8c7c2; }
@media (max-width:640px) {
  .registry-substance-filter { width: 100%; min-width: 0; }
  .registry-substance-filter .ts-control,
  .registry-substance-filter .ts-wrapper.multi.has-items .ts-control { min-height: 48px; }
  .registry-substance-filter .dropdown-input { min-height: 48px; }
  .registry-substance-filter .ts-dropdown .option { min-height: 48px; }
}
@media (forced-colors:active) {
  .registry-substance-filter :is(.ts-control,.ts-dropdown,.dropdown-input,.option) { background: Canvas !important; color: CanvasText !important; border-color: ButtonText !important; box-shadow: none; }
}
@media print {
  body { background: #fff; }
  body *, body *::before, body *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; box-shadow: none !important; }
}
