:root {
  --emv-shell-topbar-height: 68px;
  --emv-shell-nav-width: 220px;
  --emv-shell-nav-collapsed-width: 68px;
  --emv-shell-logo-width: 148px;
  --emv-shell-logo-slot-width: 148px;
  --emv-shell-brand-divider-height: 34px;
  --emv-shell-nav-item-height: 48px;
  --emv-shell-nav-item-gap: 6px;
  --emv-shell-nav-icon-slot: 22px;
  --emv-shell-content-max: 1680px;
  --emv-shell-content-gutter: clamp(16px, 2.2vw, 36px);
  --emv-shell-control-height: 38px;
  --emv-shell-radius: 6px;
  --emv-shell-border: #e3e2dc;
  --emv-shell-surface: #fff;
  --emv-shell-subtle: #f6f6f2;
  --emv-shell-text: #171817;
  --emv-shell-muted: #6f726d;
  --emv-shell-accent: #f2b42f;
  --emv-shell-active-bg: #080807;
  --emv-shell-focus: #1967d2;
  --emv-shell-shadow: none;
  --emv-shell-motion-fast: 140ms;
  --emv-shell-motion-normal: 260ms;
  --emv-shell-motion-ease: cubic-bezier(.2, .8, .2, 1);
}

:root[data-theme="dark"] {
  --emv-shell-border: #30394c;
  --emv-shell-surface: #0d1424;
  --emv-shell-subtle: #151e30;
  --emv-shell-text: #f4f5f7;
  --emv-shell-muted: #aeb7c8;
  --emv-shell-active-bg: #05070d;
  --emv-shell-shadow: 0 16px 38px rgb(0 0 0 / 34%);
}

.emv-app-topbar {
  position: relative;
  z-index: 40;
  display: flex;
  flex: 0 0 var(--emv-shell-topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-sizing: border-box;
  width: 100%;
  height: var(--emv-shell-topbar-height);
  min-height: var(--emv-shell-topbar-height);
  max-height: var(--emv-shell-topbar-height);
  padding: 0 24px;
  overflow: visible;
  color: var(--emv-shell-text);
  border: 0;
  border-bottom: 1px solid var(--emv-shell-border);
  background: var(--emv-shell-surface);
  box-shadow: var(--emv-shell-shadow);
  transition: color var(--emv-shell-motion-normal) var(--emv-shell-motion-ease), background-color var(--emv-shell-motion-normal) var(--emv-shell-motion-ease), border-color var(--emv-shell-motion-normal) var(--emv-shell-motion-ease);
}

.emv-app-topbar .emv-shell-brand {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 14px;
  width: 0;
  min-width: 200px;
  max-width: none;
  height: auto;
  margin: 0;
  overflow: hidden;
  color: var(--emv-shell-text);
  text-decoration: none;
}

.emv-app-topbar .emv-shell-logo,
.emv-app-topbar .emv-shell-brand img.emv-shell-logo {
  display: block;
  flex: 0 0 var(--emv-shell-logo-slot-width);
  width: var(--emv-shell-logo-width);
  min-width: var(--emv-shell-logo-width);
  max-width: var(--emv-shell-logo-width);
  height: auto;
  object-fit: contain;
}

.emv-app-topbar .emv-shell-brand-divider,
.emv-app-topbar .emv-shell-brand > .emv-shell-brand-divider {
  display: block;
  flex: 0 0 1px;
  width: 1px;
  min-width: 1px;
  height: var(--emv-shell-brand-divider-height);
  margin: 0;
  background: var(--emv-shell-border);
}

.emv-app-topbar .emv-shell-brand-copy,
.emv-app-topbar .emv-shell-brand > .emv-shell-brand-copy {
  display: grid;
  flex: 0 1 210px;
  gap: 2px;
  width: 210px;
  min-width: 132px;
  max-width: 210px;
  height: auto;
  margin: 0;
  overflow: hidden;
  background: transparent;
}

.emv-app-topbar .emv-shell-brand-title,
.emv-app-topbar .emv-shell-brand-subtitle {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--emv-shell-text);
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  writing-mode: horizontal-tb;
}

.emv-app-topbar .emv-shell-brand-title { font-size: 18px; font-weight: 820; line-height: 1.18; }
.emv-app-topbar .emv-shell-brand-subtitle { color: var(--emv-shell-muted); font-size: 12px; font-weight: 700; line-height: 1.2; }

.emv-app-topbar .emv-shell-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  height: var(--emv-shell-control-height);
  color: var(--emv-shell-muted);
  font-size: 14px;
  white-space: nowrap;
}

.emv-app-topbar .emv-shell-theme-toggle,
.emv-shell-account > summary {
  box-sizing: border-box;
  min-height: var(--emv-shell-control-height);
  height: var(--emv-shell-control-height);
  border: 1px solid transparent;
  border-radius: var(--emv-shell-radius);
  color: var(--emv-shell-text);
  background: transparent;
}

.emv-app-topbar .emv-shell-language {
  display: inline-flex;
  flex: 0 0 auto;
  height: var(--emv-shell-control-height);
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--emv-shell-radius);
  background: var(--emv-shell-subtle);
}
.emv-app-topbar .emv-shell-language .emv-shell-language-button {
  box-sizing: border-box;
  width: auto;
  min-width: 58px;
  min-height: calc(var(--emv-shell-control-height) - 2px);
  padding: 0 9px;
  color: var(--emv-shell-muted);
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 820;
  cursor: pointer;
  transition: color var(--emv-shell-motion-fast) ease, background-color var(--emv-shell-motion-fast) ease;
}
.emv-app-topbar .emv-shell-language .emv-shell-language-button + .emv-shell-language-button { border-left: 1px solid var(--emv-shell-border); }
.emv-app-topbar .emv-shell-language .emv-shell-language-button:not(.is-active):hover { color: var(--emv-shell-text); background: color-mix(in srgb, var(--emv-shell-accent) 10%, transparent); }
.emv-app-topbar .emv-shell-language .emv-shell-language-button.is-active { color: #080807; background: var(--emv-shell-accent); }
.emv-app-topbar .emv-shell-language-compact { display: none; }

.emv-shell-account { position: relative; display: block; flex: 0 0 auto; min-width: 0; padding: 0; }
.emv-shell-account > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 168px;
  max-width: 168px;
  padding: 4px 10px;
  cursor: pointer;
  list-style: none;
  transition: border-color var(--emv-shell-motion-fast) ease, transform var(--emv-shell-motion-fast) var(--emv-shell-motion-ease);
}
.emv-shell-account > summary::-webkit-details-marker { display: none; }
.emv-shell-account > summary > span { display: grid; min-width: 0; text-align: left; }
.emv-shell-account > summary strong,
.emv-shell-account > summary small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emv-shell-account > summary small { color: var(--emv-shell-muted); font-size: 11px; }
.emv-shell-account[open] > summary,
.emv-shell-account > summary:hover { border-color: color-mix(in srgb, var(--emv-shell-accent) 62%, var(--emv-shell-border)); background: var(--emv-shell-subtle); }
.emv-shell-account > summary:active { transform: scale(.98); }
.emv-shell-account > summary > svg:last-child { transition: transform var(--emv-shell-motion-normal) var(--emv-shell-motion-ease); }
.emv-shell-account[open] > summary > svg:last-child { transform: rotate(180deg); }

.emv-shell-account-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 4px;
  min-width: 210px;
  padding: 12px;
  color: var(--emv-shell-text);
  border: 1px solid var(--emv-shell-border);
  border-radius: var(--emv-shell-radius);
  background: var(--emv-shell-surface);
  box-shadow: 0 14px 36px rgb(15 23 42 / 16%);
  transform-origin: top right;
  animation: emv-shell-popover-in var(--emv-shell-motion-normal) var(--emv-shell-motion-ease) both;
}
.emv-shell-account-popover small { color: var(--emv-shell-muted); }
.emv-shell-account-popover button { min-height: var(--emv-shell-control-height); display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 0 10px; color: var(--emv-shell-text); border: 1px solid var(--emv-shell-border); border-radius: var(--emv-shell-radius); background: var(--emv-shell-subtle); }
.emv-shell-account-popover button:hover { color: var(--emv-shell-accent); border-color: var(--emv-shell-accent); }
.emv-shell-account-popover button:active { transform: scale(.98); }

.emv-app-topbar .emv-shell-theme-toggle {
  display: inline-grid;
  flex: 0 0 var(--emv-shell-control-height);
  place-items: center;
  width: var(--emv-shell-control-height);
  padding: 0;
  transition: border-color var(--emv-shell-motion-fast) ease, background-color var(--emv-shell-motion-fast) ease, transform var(--emv-shell-motion-fast) var(--emv-shell-motion-ease);
}
.emv-app-topbar .emv-shell-theme-toggle:hover { border-color: color-mix(in srgb, var(--emv-shell-accent) 62%, var(--emv-shell-border)); background: var(--emv-shell-subtle); transform: translateY(-1px); }
.emv-app-topbar .emv-shell-theme-toggle:active { transform: scale(.94); }
.emv-app-topbar .emv-shell-theme-toggle.is-dark { color: #080807; border-color: var(--emv-shell-accent); background: var(--emv-shell-accent); }

.emv-app-layout {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: var(--emv-shell-nav-width) minmax(0, 1fr);
  width: 100%;
  height: calc(100vh - var(--emv-shell-topbar-height));
  min-height: 0;
  transition: grid-template-columns var(--emv-shell-motion-normal) var(--emv-shell-motion-ease);
}
.emv-app-layout.nav-collapsed { grid-template-columns: var(--emv-shell-nav-collapsed-width) minmax(0, 1fr); }

.emv-app-layout > .emv-app-sidebar {
  position: static;
  top: auto;
  display: flex;
  align-self: stretch;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 0;
  padding: 18px 10px;
  overflow: auto;
  color: var(--emv-shell-text);
  border: 0;
  border-right: 1px solid var(--emv-shell-border);
  background: var(--emv-shell-surface);
}
.emv-app-layout.nav-collapsed > .emv-app-sidebar { padding-right: 8px; padding-left: 8px; }
.emv-app-sidebar .emv-shell-nav-list { display: grid; gap: var(--emv-shell-nav-item-gap); min-width: 0; }
.emv-app-sidebar .emv-shell-nav-section-label {
  padding: 2px 14px 6px;
  color: var(--emv-shell-muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.emv-app-sidebar .emv-shell-nav-section-label.is-management {
  margin-top: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--emv-shell-border);
}
.emv-app-sidebar .emv-shell-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  height: var(--emv-shell-nav-item-height);
  min-height: var(--emv-shell-nav-item-height);
  padding: 0 14px;
  overflow: hidden;
  color: var(--emv-shell-muted);
  border: 0;
  border-radius: 4px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--emv-shell-motion-fast) ease, background-color var(--emv-shell-motion-fast) ease, box-shadow var(--emv-shell-motion-fast) ease, transform var(--emv-shell-motion-fast) var(--emv-shell-motion-ease);
}
.emv-app-sidebar .emv-shell-nav-item:hover { color: var(--emv-shell-text); background: color-mix(in srgb, var(--emv-shell-accent) 10%, transparent); box-shadow: inset 2px 0 0 color-mix(in srgb, var(--emv-shell-accent) 58%, transparent); }
.emv-app-sidebar .emv-shell-nav-item:active { transform: scale(.985); }
.emv-app-sidebar .emv-shell-nav-item.active,
.emv-app-sidebar .emv-shell-nav-item.is-active,
:root[data-theme="dark"] .emv-app-sidebar .emv-shell-nav-item.active,
:root[data-theme="dark"] .emv-app-sidebar .emv-shell-nav-item.is-active { color: var(--emv-shell-accent); background: var(--emv-shell-active-bg); box-shadow: inset 3px 0 0 var(--emv-shell-accent); font-weight: 820; }
.emv-app-sidebar .emv-shell-nav-icon { display: inline-grid; flex: 0 0 var(--emv-shell-nav-icon-slot); width: var(--emv-shell-nav-icon-slot); height: var(--emv-shell-nav-icon-slot); place-items: center; color: currentColor; }
.emv-app-sidebar .emv-shell-nav-icon svg { width: 20px; height: 20px; }
.emv-app-sidebar .emv-shell-nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emv-app-layout.nav-collapsed .emv-app-sidebar .emv-shell-nav-item { justify-content: center; gap: 0; padding: 0; }
.emv-app-layout.nav-collapsed .emv-app-sidebar .emv-shell-nav-item:hover { transform: translateY(-2px); }
.emv-app-layout.nav-collapsed .emv-app-sidebar .emv-shell-nav-item.active,
.emv-app-layout.nav-collapsed .emv-app-sidebar .emv-shell-nav-item.is-active { box-shadow: inset 0 -3px 0 var(--emv-shell-accent); }
.emv-app-layout.nav-collapsed .emv-app-sidebar .emv-shell-nav-icon { width: var(--emv-shell-nav-icon-slot); }
.emv-app-layout.nav-collapsed .emv-app-sidebar .emv-shell-nav-label { display: none; }
.emv-app-layout.nav-collapsed .emv-app-sidebar .emv-shell-nav-section-label { display: none; }
.emv-app-layout.nav-collapsed .emv-app-sidebar .emv-shell-nav-item[data-nav-index="7"] { margin-top: 14px; }
.emv-app-layout.nav-collapsed .emv-app-sidebar .emv-shell-nav-item[data-nav-index="7"]::before {
  position: absolute;
  top: -9px;
  right: 8px;
  left: 8px;
  height: 1px;
  content: "";
  background: var(--emv-shell-border);
}
.emv-app-sidebar .emv-shell-nav-item[data-nav-index="7"] { position: relative; }

.emv-app-sidebar .emv-shell-collapse {
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  padding: 14px;
  color: var(--emv-shell-muted);
  border: 0;
  border-top: 1px solid var(--emv-shell-border);
  background: transparent;
  font: inherit;
  font-size: 14px;
  text-align: left;
  transition: color var(--emv-shell-motion-fast) ease, background-color var(--emv-shell-motion-fast) ease, transform var(--emv-shell-motion-fast) var(--emv-shell-motion-ease);
}
.emv-app-sidebar .emv-shell-collapse:hover { color: var(--emv-shell-accent); background: color-mix(in srgb, var(--emv-shell-accent) 8%, transparent); }
.emv-app-sidebar .emv-shell-collapse:active { transform: scale(.97); }
.emv-app-layout.nav-collapsed .emv-app-sidebar .emv-shell-collapse { justify-content: center; padding-right: 0; padding-left: 0; }

.emv-app-layout > main { min-width: 0; animation: emv-shell-content-in var(--emv-shell-motion-normal) var(--emv-shell-motion-ease) both; }
.report-main > :where(header, section, div),
.portal-main.report-main > :where(header, section, div) { width: min(100%, var(--emv-shell-content-max)); margin-inline: auto; }
.emv-app-topbar :where(button, a, summary, select):focus-visible,
.emv-app-sidebar :where(button, a):focus-visible { outline: 3px solid color-mix(in srgb, var(--emv-shell-focus) 35%, transparent); outline-offset: 2px; }
.emv-app-topbar .emv-shell-mobile-nav { display: none; }

@keyframes emv-shell-popover-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes emv-shell-content-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1380px) {
  .emv-shell-account > summary { width: var(--emv-shell-control-height); justify-content: center; padding: 4px 8px; }
  .emv-shell-account > summary > span,
  .emv-shell-account > summary > svg:last-child { display: none; }
}

@media (max-width: 1180px) {
  .emv-app-topbar { padding-inline: 18px; }
  .emv-app-topbar .emv-shell-brand-copy,
  .emv-app-topbar .emv-shell-brand > .emv-shell-brand-copy { flex-basis: 180px; width: 180px; }
}

@media (max-width: 840px) {
  :root { --emv-shell-topbar-height: 116px; --emv-shell-content-gutter: 14px; }
  .emv-app-topbar {
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    gap: 8px;
    height: var(--emv-shell-topbar-height);
    min-height: var(--emv-shell-topbar-height);
    max-height: var(--emv-shell-topbar-height);
    padding: 8px 12px;
  }
  .emv-app-topbar .emv-shell-brand { flex: 1 1 132px; width: auto; min-width: 116px; }
  .emv-app-topbar .emv-shell-logo,
  .emv-app-topbar .emv-shell-brand img.emv-shell-logo { --emv-shell-logo-width: 112px; --emv-shell-logo-slot-width: 112px; }
  .emv-app-topbar .emv-shell-brand-copy,
  .emv-app-topbar .emv-shell-brand > .emv-shell-brand-copy { display: none; }
  .emv-app-topbar .emv-shell-tools { flex: 0 0 auto; justify-content: flex-end; margin-left: auto; }
  .emv-app-layout,
  .emv-app-layout.nav-collapsed { display: block; height: calc(100vh - var(--emv-shell-topbar-height)); }
  .emv-app-layout > .emv-app-sidebar { display: none; }
  .emv-app-topbar .emv-shell-mobile-nav { display: grid; flex: 0 0 100%; grid-auto-columns: minmax(104px, 1fr); grid-auto-flow: column; grid-template-columns: none; gap: 6px; width: 100%; padding-bottom: 2px; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; scroll-behavior: smooth; scroll-padding-inline: 12px; scroll-snap-type: x proximity; }
  .emv-app-topbar .emv-shell-mobile-nav-item { min-height: var(--emv-shell-control-height); display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 10px; overflow: hidden; color: var(--emv-shell-muted); border: 1px solid transparent; border-radius: var(--emv-shell-radius); background: var(--emv-shell-subtle); font-size: 12px; font-weight: 800; text-decoration: none; white-space: nowrap; scroll-snap-align: center; transition: color var(--emv-shell-motion-fast) ease, background-color var(--emv-shell-motion-fast) ease, transform var(--emv-shell-motion-fast) var(--emv-shell-motion-ease); }
  .emv-app-topbar .emv-shell-mobile-nav-item svg { flex: 0 0 16px; width: 16px; height: 16px; }
  .emv-app-topbar .emv-shell-mobile-nav-item span { overflow: hidden; text-overflow: ellipsis; }
  .emv-app-topbar .emv-shell-mobile-nav-item.is-active { color: var(--emv-shell-accent); border-color: var(--emv-shell-active-bg); background: var(--emv-shell-active-bg); }
  .emv-app-topbar .emv-shell-mobile-nav-item:active { transform: scale(.96); }
  .report-main,
  .portal-main.report-main { padding-inline: var(--emv-shell-content-gutter); }
}

@media (min-width: 641px) and (max-width: 840px) {
  .emv-app-topbar .emv-shell-brand {
    flex: 1 1 230px;
    gap: 10px;
    min-width: 0;
  }

  .emv-app-topbar .emv-shell-logo,
  .emv-app-topbar .emv-shell-brand img.emv-shell-logo {
    --emv-shell-logo-width: 96px;
    --emv-shell-logo-slot-width: 96px;
  }

  .emv-app-topbar .emv-shell-brand-copy,
  .emv-app-topbar .emv-shell-brand > .emv-shell-brand-copy {
    display: grid;
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: 140px;
  }

  .emv-app-topbar .emv-shell-brand-title {
    max-width: 140px;
  }

  .emv-app-topbar .emv-shell-tools {
    margin-left: auto;
  }
}

@media (max-width: 560px) {
  .emv-app-topbar .emv-shell-brand { flex-basis: 88px; min-width: 88px; }
  .emv-app-topbar .emv-shell-logo,
  .emv-app-topbar .emv-shell-brand img.emv-shell-logo { --emv-shell-logo-width: 88px; --emv-shell-logo-slot-width: 88px; }
  .emv-app-topbar .emv-shell-brand-divider { display: none; }
  .emv-app-topbar .emv-shell-language-full { display: none; }
  .emv-app-topbar .emv-shell-language-compact { display: inline; }
  .emv-app-topbar .emv-shell-language .emv-shell-language-button { min-width: 34px; padding: 0 6px; }
  .emv-shell-account-popover { right: -4px; min-width: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --emv-shell-motion-fast: 0ms; --emv-shell-motion-normal: 0ms; }
  .emv-app-topbar,
  .emv-app-layout,
  .emv-app-layout > main,
  .emv-app-sidebar .emv-shell-nav-item,
  .emv-app-sidebar .emv-shell-collapse,
  .emv-app-topbar .emv-shell-mobile-nav-item,
  .emv-shell-account > summary,
  .emv-shell-account > summary > svg:last-child,
  .emv-shell-account-popover,
  .emv-shell-account-popover button { animation: none !important; scroll-behavior: auto !important; transition-duration: 0ms !important; }
}
