:root {
  --white: #ffffff;
  --light: #fcfcfc;
  --paper: #f7f7f7;
  --line: #e2e2e2;
  --line-strong: #d1d1d1;
  --black-01: #6a6a6a;
  --black-02: #333333;
  --black-03: #1d1d1d;
  --muted: var(--black-01);
  --shadow: 0 18px 42px rgba(29, 29, 29, 0.12);
  --soft-shadow: 0 8px 24px rgba(29, 29, 29, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --display: "Headland One", Georgia, serif;
  --ui: "Gotu", "Segoe UI", system-ui, sans-serif;
  color: var(--black-03);
  background: var(--paper);
  font-family: var(--ui);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 102% -12%, transparent 0 170px, rgba(29, 29, 29, 0.16) 171px, transparent 172px),
    radial-gradient(circle at -12% 24%, transparent 0 230px, rgba(29, 29, 29, 0.12) 231px, transparent 232px),
    var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

  button {
  cursor: pointer;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes preview-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes feature-panel-in {
  from {
    opacity: 0;
    transform: translateX(28px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes metric-swap {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  55% {
    opacity: 1;
    transform: translateY(-2px) scale(1.015);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sheen-pass {
  from {
    transform: translateX(-130%) skewX(-16deg);
  }
  to {
    transform: translateX(150%) skewX(-16deg);
  }
}

@keyframes active-metric-pop {
  0% {
    transform: translateX(0) scale(0.985);
  }
  60% {
    transform: translateX(-5px) scale(1.01);
  }
  100% {
    transform: translateX(-3px) scale(1);
  }
}

.app-shell {
  display: none;
  width: min(1520px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.app-boot-screen {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
}

.app-boot-screen img {
  width: 168px;
  height: auto;
}

.app-boot-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-top-color: var(--black-03);
  border-radius: 50%;
  animation: app-boot-spin 700ms linear infinite;
}

body.is-booting .app-boot-screen {
  display: grid;
}

body.is-booting .login-view,
body.is-booting .app-shell,
body.is-booting .activation-success-view {
  visibility: hidden;
}

@keyframes app-boot-spin {
  to { transform: rotate(360deg); }
}

body.is-authenticated .app-shell {
  display: block;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

body.is-authenticated .login-view {
  display: none;
}

body.is-activation-complete .login-view {
  display: none;
}

.activation-success-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.activation-success-view[hidden] {
  display: none;
}

.activation-success-card {
  width: min(520px, 100%);
  display: grid;
  justify-items: start;
  gap: 16px;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  animation: dialog-in 240ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.activation-success-card h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 40px;
  line-height: 1.12;
}

.activation-success-card > p:not(.eyebrow) {
  margin: 0;
  color: var(--black-01);
  line-height: 1.6;
}

.activation-success-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dff3e5;
  color: #176b35;
}

.activation-success-icon svg {
  width: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 16px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-logo {
  width: 190px;
  height: auto;
  margin-bottom: 8px;
}

.login-card h1 {
  margin: -6px 0 4px;
  font-family: var(--display);
  font-size: clamp(36px, 7vw, 54px);
  line-height: 1;
}

.login-card .button {
  min-height: 48px;
}

.login-card .button.primary {
  position: relative;
  overflow: hidden;
}

.login-card .button.primary::before,
.login-card .button.primary::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  opacity: 0;
  pointer-events: none;
}

.login-card .button.primary.is-loading,
.login-card .button.primary.is-success,
.login-card .button.primary.is-error {
  color: transparent;
}

.login-card .button.primary.is-loading {
  background: var(--black-03) !important;
  border-color: var(--black-03) !important;
}

.login-card .button.primary.is-loading::before {
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  opacity: 1;
  animation: login-spin 720ms linear infinite;
}

.login-card .button.primary.is-success {
  background: #277a4f !important;
  border-color: #277a4f !important;
  animation: login-success-glow 560ms ease both;
}

.login-card .button.primary.is-success:hover {
  background: #277a4f !important;
  border-color: #277a4f !important;
}

.login-card .button.primary.is-success::before {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  opacity: 1;
  animation: login-mark-pop 360ms cubic-bezier(0.2, 1.25, 0.3, 1) both;
}

.login-card .button.primary.is-success::after {
  width: 15px;
  height: 8px;
  margin: -7px 0 0 -7px;
  border-left: 3px solid #ffffff;
  border-bottom: 3px solid #ffffff;
  opacity: 0;
  transform: rotate(-45deg);
  animation: login-check-in 360ms 120ms cubic-bezier(0.2, 0.9, 0.25, 1) both;
}

.login-card .button.primary.is-error {
  background: #a83a35 !important;
  border-color: #a83a35 !important;
  animation: login-error-nudge 300ms ease both, login-error-glow 560ms ease both;
}

.login-card .button.primary.is-error:hover {
  background: #a83a35 !important;
  border-color: #a83a35 !important;
}

.login-card .button.primary.is-error::before {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  opacity: 1;
  animation: login-mark-pop 360ms cubic-bezier(0.2, 1.25, 0.3, 1) both;
}

.login-card .button.primary.is-error::after {
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  opacity: 1;
  background:
    linear-gradient(45deg, transparent calc(50% - 1.5px), #ffffff calc(50% - 1.5px), #ffffff calc(50% + 1.5px), transparent calc(50% + 1.5px)),
    linear-gradient(-45deg, transparent calc(50% - 1.5px), #ffffff calc(50% - 1.5px), #ffffff calc(50% + 1.5px), transparent calc(50% + 1.5px));
  transform: scale(0.5) rotate(-12deg);
  animation: login-x-in 360ms 120ms cubic-bezier(0.2, 1.25, 0.3, 1) both;
}

.login-card label,
.login-card .button,
.login-card .link-button,
.activation-hint {
  transition:
    opacity 210ms ease,
    transform 210ms ease,
    max-height 260ms ease,
    margin 260ms ease,
    background 200ms ease,
    border-color 200ms ease,
    color 160ms ease;
}

.login-card.is-activation-ready #loginPasswordLabel,
.login-card.is-activation-ready #loginSubmitButton,
.login-card.is-activation-ready #loginRememberLabel,
.login-card.is-activation-ready #forgotPasswordButton {
  max-height: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-6px);
}

.login-card:not(.is-activation-ready) .activation-button {
  max-height: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(6px);
}

.activation-button {
  transform-origin: center;
}

.login-card.is-activation-ready .activation-button {
  animation: activation-pop 220ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.activation-hint {
  display: grid;
  gap: 6px;
  color: var(--black-02);
  font-size: 14px;
  line-height: 1.45;
}

.activation-hint:empty {
  display: none;
}

.activation-hint a {
  color: var(--black-03);
  overflow-wrap: anywhere;
}

.login-card .remember-card {
  width: fit-content;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  min-height: 28px;
  margin: -4px 0 -2px;
  padding: 2px 0;
  color: var(--black-01);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
}

.login-card .remember-card:hover {
  color: var(--black-03);
}

.login-card .remember-card input {
  appearance: none;
  position: relative;
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--white);
  box-shadow: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.login-card .remember-card input::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border-right: 2px solid var(--white);
  border-bottom: 2px solid var(--white);
  opacity: 0;
  transform: rotate(45deg) scale(0.7);
  transition: opacity 140ms ease, transform 160ms ease;
}

.login-card .remember-card input:checked {
  border-color: var(--black-03);
  background: var(--black-03);
}

.login-card .remember-card input:checked::before {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}

.login-card .remember-card input:focus-visible {
  outline: 2px solid var(--black-03);
  outline-offset: 3px;
}

@keyframes activation-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes login-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes login-mark-pop {
  0% {
    opacity: 0;
    transform: scale(0.55);
  }
  72% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes login-check-in {
  0% {
    opacity: 0;
    width: 0;
    height: 0;
    transform: rotate(-45deg) translate(-2px, 2px);
  }
  42% {
    opacity: 1;
    width: 0;
    height: 8px;
  }
  100% {
    opacity: 1;
    width: 15px;
    height: 8px;
    transform: rotate(-45deg) translate(0, 0);
  }
}

@keyframes login-x-in {
  0% {
    opacity: 0;
    transform: scale(0.45) rotate(-18deg);
  }
  72% {
    opacity: 1;
    transform: scale(1.12) rotate(4deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes login-error-nudge {
  0% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-4px);
  }
  70% {
    transform: translateX(4px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes login-success-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(39, 122, 79, 0);
  }
  45% {
    box-shadow: 0 0 0 5px rgba(39, 122, 79, 0.16);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(39, 122, 79, 0);
  }
}

@keyframes login-error-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(168, 58, 53, 0);
  }
  45% {
    box-shadow: 0 0 0 5px rgba(168, 58, 53, 0.14);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(168, 58, 53, 0);
  }
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 54px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 36px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  transform: translateY(-50%);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.password-toggle::before,
.password-toggle::after {
  content: none;
}

.password-eye-icon {
  width: 20px;
  height: 20px;
  overflow: visible;
  fill: none;
  stroke: var(--black-01);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 160ms ease, transform 220ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.password-eye-pupil {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 220ms ease, opacity 180ms ease;
}

.password-eye-slash {
  stroke: var(--black-03);
  stroke-dasharray: 23;
  stroke-dashoffset: 23;
  opacity: 0;
  transition: stroke-dashoffset 240ms ease, opacity 120ms ease;
}

.password-toggle.is-visible .password-eye-icon {
  stroke: var(--black-03);
  transform: scale(0.96);
}

.password-toggle.is-visible .password-eye-pupil {
  opacity: 0.45;
  transform: scale(0.65);
}

.password-toggle.is-visible .password-eye-slash {
  stroke-dashoffset: 0;
  opacity: 1;
}

.password-toggle:hover {
  border-color: var(--line);
  background: var(--paper);
  transform: translateY(-50%) scale(1.04);
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.94);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--black-03);
  outline-offset: 2px;
}

.topbar {
  display: grid;
  grid-template-columns: 230px minmax(320px, 640px) auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 18px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  width: fit-content;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
  transition: transform 160ms ease;
}

.brand-lockup:hover {
  transform: translateY(-1px);
}

.brand-logo {
  display: block;
  width: 190px;
  height: auto;
  max-height: 58px;
  object-fit: contain;
}

.global-search {
  position: relative;
  display: block;
  z-index: 30;
}

.global-search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.global-search::before {
  content: "⌕";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 28px;
  line-height: 1;
}

.global-search input {
  height: 48px;
  padding-left: 54px;
  box-shadow: var(--soft-shadow);
  width: 100%;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  max-height: min(440px, calc(100vh - 140px));
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(252, 252, 252, 0.98);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.global-search-results.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.global-search-group {
  display: grid;
  gap: 6px;
}

.global-search-group + .global-search-group {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.global-search-group > span,
.global-search-empty {
  display: block;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
}

.global-search-result {
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.global-search-result:hover,
.global-search-result:focus-visible {
  background: #f0f0f0;
  transform: translateY(-1px);
}

.global-search-result strong,
.global-search-result span {
  display: block;
}

.global-search-result strong {
  font-size: 14px;
}

.global-search-result span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-meta,
.topbar-actions,
.module-strip,
.breadcrumbs,
.module-header,
.calendar-toolbar,
.date-nav,
.dialog-actions,
.details-actions,
.record-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-actions {
  justify-content: flex-end;
}

.topbar-icon-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--black-03);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.topbar-icon-button:hover {
  border-color: var(--line-strong);
  background: var(--light);
  transform: translateY(-1px);
}

.topbar-icon-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.user-pill {
  max-width: 230px;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  color: var(--black-02);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button,
.module-tab,
.segment,
.icon-button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--black-03);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  transition: 0.15s ease;
}

.button:hover,
.module-tab:hover,
.segment:hover,
.icon-button:hover {
  border-color: var(--black-02);
}

.button.primary,
.module-tab.is-active,
.segment.is-active {
  background: var(--black-03);
  border-color: var(--black-03);
  color: var(--white);
}

.module-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 18px;
}

.module-panel-mode {
  display: none;
}

.module-panel-mode.is-active {
  display: block;
  animation: view-in 180ms ease both;
}

.button.secondary {
  background: var(--white);
}

.button.danger {
  color: var(--black-03);
  background: #efefef;
  border-color: var(--line-strong);
  margin-right: auto;
}

.link-button {
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--black-02);
  padding: 2px 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.link-button:hover {
  color: var(--black-03);
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.module-strip {
  margin: 0 0 14px;
  padding: 6px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
  flex-wrap: wrap;
}

.module-tab {
  min-width: 118px;
  box-shadow: none;
}

.breadcrumbs {
  min-height: 28px;
  margin: 0 0 28px;
  color: var(--black-01);
  font-size: 14px;
  gap: 9px;
  flex-wrap: wrap;
}

.breadcrumb-link {
  border: 0;
  background: transparent;
  color: var(--black-01);
  padding: 0;
  min-height: auto;
  border-radius: 0;
  box-shadow: none;
}

.breadcrumb-link:hover {
  color: var(--black-03);
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--line-strong);
}

.breadcrumbs [aria-current="page"] {
  color: var(--black-03);
}

body.is-kp-generator-view .breadcrumbs {
  display: none;
}

body:has(#kpGeneratorView.is-active) .breadcrumbs {
  display: none;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: view-in 220ms ease both;
}

.dashboard-overview {
  display: grid;
  grid-template-columns: minmax(0, 900px) minmax(320px, 380px);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
  justify-content: space-between;
  max-width: none;
}

.dashboard-main-column {
  min-width: 0;
}

.dashboard-main-column .module-header {
  margin-bottom: 18px;
}

.dashboard-panel-stack {
  display: grid;
  gap: 28px;
}

.dashboard-zone {
  display: grid;
  gap: 14px;
}

.dashboard-zone-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 2px;
}

.dashboard-zone-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 400;
  line-height: 1.05;
}

.dashboard-zone-heading .eyebrow {
  margin-bottom: 6px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
}

.dashboard-grid-admin {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.dashboard-card {
  min-height: 170px;
  display: grid;
  align-content: space-between;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--black-03);
  text-align: left;
  box-shadow: var(--shadow);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.dashboard-card:not(.dashboard-card-static):hover {
  border-color: var(--black-03);
  transform: translateY(-1px);
}

.dashboard-card-label {
  color: var(--black-01);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.dashboard-card strong {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.15;
}

.dashboard-card small {
  color: var(--black-01);
  font-size: 13px;
}

.dashboard-preferences-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-preference-option {
  min-height: 52px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.dashboard-feature-panel {
  position: relative;
  justify-self: end;
  width: min(380px, 100%);
  margin-top: -126px;
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background:
    linear-gradient(135deg, rgba(106, 106, 106, 0.14), transparent 34%),
    rgba(255, 255, 255, 0.88);
  box-shadow: 0 28px 70px rgba(29, 29, 29, 0.14);
  transform-origin: right center;
  animation: feature-panel-in 420ms cubic-bezier(0.18, 0.9, 0.2, 1) both;
}

.dashboard-feature-panel::before {
  content: "";
  position: absolute;
  inset: -1px auto -1px -1px;
  width: 6px;
  border-radius: calc(var(--radius) + 6px) 0 0 calc(var(--radius) + 6px);
  background: linear-gradient(to bottom, var(--black-01), var(--black-03));
}

.feature-panel-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--black-01);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.feature-panel-label > span {
  white-space: nowrap;
}

.feature-panel-label > span::after {
  content: "";
  display: inline-block;
  width: 64px;
  height: 1px;
  margin-left: 12px;
  vertical-align: middle;
  background: var(--line);
}

.feature-panel-controls {
  display: inline-flex;
  gap: 6px;
}

.feature-control {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--black-03);
  line-height: 1;
  transition: border-color 160ms ease, transform 160ms ease;
}

.feature-control:hover {
  border-color: var(--black-03);
  transform: translateY(-1px);
}

.feature-control:active {
  transform: translateY(0) scale(0.94);
}

.feature-hero {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 230px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 24px;
  border: 0;
  border-radius: var(--radius);
  background: var(--black-03);
  color: var(--white);
  text-align: left;
  box-shadow: 0 18px 42px rgba(29, 29, 29, 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.feature-hero::after {
  content: "";
  position: absolute;
  inset: -20% auto -20% 0;
  width: 42%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-130%) skewX(-16deg);
}

.feature-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 52px rgba(29, 29, 29, 0.22);
}

.feature-hero:active {
  transform: translateY(0) scale(0.992);
}

.feature-hero.is-changing::after {
  opacity: 1;
  animation: sheen-pass 560ms ease both;
}

.feature-hero.is-changing .feature-hero-number,
.feature-hero.is-changing > small {
  animation: metric-swap 340ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.feature-hero p {
  margin: 0;
}

.feature-hero .eyebrow,
.feature-hero small {
  color: rgba(255, 255, 255, 0.72);
}

.feature-hero-number {
  display: grid;
  gap: 4px;
}

.feature-hero-number strong {
  font-family: var(--display);
  font-size: clamp(86px, 10vw, 132px);
  font-weight: 400;
  line-height: 0.82;
}

.feature-hero-number span {
  max-width: 240px;
  font-size: 18px;
  line-height: 1.25;
}

.feature-clock,
.feature-metrics {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--soft-shadow);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.feature-clock:hover,
.feature-metrics:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(29, 29, 29, 0.1);
}

.feature-clock {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.feature-clock span,
.feature-metrics-heading span {
  color: var(--black-01);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.feature-clock strong {
  justify-self: end;
  font-family: var(--display);
  font-size: 40px;
  font-weight: 400;
  line-height: 1;
}

.feature-clock small {
  grid-column: 1 / -1;
  color: var(--black-01);
}

.feature-metrics-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.feature-metrics-heading small {
  color: var(--black-01);
  font-size: 12px;
}

.dashboard-metric-list {
  display: grid;
  gap: 8px;
}

.dashboard-metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--black-03);
  text-align: left;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.dashboard-metric-row:hover {
  border-color: var(--black-03);
  transform: translateX(-2px);
}

.dashboard-metric-row.is-active {
  border-color: var(--black-03);
  background: var(--black-03);
  color: var(--white);
  animation: active-metric-pop 240ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.dashboard-metric-row span {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-metric-row small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: inherit;
  opacity: 0.68;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-metric-row strong {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
}

.news-panel {
  padding: 18px;
}

.news-list {
  display: grid;
  gap: 12px;
}

.news-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--black-03);
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: var(--soft-shadow);
}

.news-item span {
  color: var(--black-01);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.news-item h3 {
  margin: 4px 0 6px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
}

.news-item p {
  margin: 0;
  color: var(--black-02);
}

.news-item-warning {
  border-left-color: #b88a24;
}

.news-item-calendar {
  border-left-color: #2f8f72;
}

.news-item-case {
  border-left-color: #333333;
}

.news-item-admin {
  border-left-color: #6f5d9a;
}

.news-item-tree {
  border-left-color: #4f6f52;
}

.news-item-notice,
.news-item-system {
  border-left-color: var(--black-01);
}

.module-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.news-admin-panel {
  margin-top: 18px;
  overflow: hidden;
}

.news-manage-list {
  display: grid;
}

.news-manage-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.news-manage-item.is-archived {
  opacity: 0.62;
}

.news-manage-item span {
  color: var(--black-01);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.news-manage-item h3 {
  margin: 4px 0 5px;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 400;
}

.news-manage-item p {
  margin: 0;
  color: var(--black-02);
}

.news-manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.news-manage-actions .button.danger {
  margin-right: 0;
}

.module-header {
  justify-content: space-between;
  margin-bottom: 18px;
}

.module-header h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(32px, 4.5vw, 58px);
  line-height: 1.05;
  font-weight: 400;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--black-01);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.toolbar {
  display: grid;
  grid-template-columns: 220px 260px;
  gap: 12px;
  justify-content: end;
  margin-bottom: 18px;
}

label,
.field-label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--black-02);
  font-size: 13px;
  font-weight: 700;
}

.checkbox-row {
  min-height: 42px;
  align-self: end;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: 0 5px 14px rgba(29, 29, 29, 0.06);
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  box-shadow: none;
}

.is-hidden {
  display: none !important;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--black-03);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  min-height: 42px;
  box-shadow: 0 5px 14px rgba(29, 29, 29, 0.06);
}

input[type="color"] {
  min-height: 42px;
  padding: 4px;
  cursor: pointer;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid var(--black-03);
  outline-offset: 2px;
}

.split-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel,
.case-card,
.case-summary,
.context-card,
.dialog {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.case-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, #b88a24 45%, var(--line));
  border-left: 6px solid #b88a24;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, #b88a24 10%, var(--white));
  box-shadow: var(--soft-shadow);
}

.case-alert div {
  display: grid;
  gap: 4px;
}

.case-alert strong {
  font-size: 14px;
}

.case-alert span {
  color: var(--black-02);
  font-size: 13px;
  line-height: 1.45;
}

.case-list-panel {
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2,
.context-card h3,
.agenda-panel h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.panel-heading span {
  color: var(--black-01);
  font-size: 13px;
}

.record-list {
  max-height: 690px;
  overflow: auto;
}

.record-item {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 15px 16px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.record-item:hover {
  background: #f6f6f6;
}

.record-item.is-active {
  background: #f0f0f0;
  box-shadow: inset 5px 0 0 var(--black-03);
}

.record-main {
  justify-content: space-between;
  align-items: flex-start;
}

.record-title {
  display: block;
  font-weight: 800;
}

.office-case-layout {
  grid-template-columns: minmax(520px, 1.1fr) minmax(360px, 0.9fr);
}

.office-case-list {
  max-height: 720px;
}

.office-case-row {
  width: 100%;
  display: grid;
  grid-template-columns: 110px minmax(220px, 1.6fr) minmax(160px, 0.9fr) 100px 130px;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--black-03);
  text-align: left;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.office-case-row:hover {
  background: #f6f6f6;
}

.office-case-row.is-active {
  background: #f0f0f0;
  box-shadow: inset 5px 0 0 var(--black-03);
}

.office-case-cell {
  min-width: 0;
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.office-case-cell strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.office-case-cell small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.office-case-topic strong {
  font-size: 15px;
}

.office-case-details-panel {
  display: grid;
  gap: 16px;
}

.panel-note {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--light);
}

.panel-note span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel-note p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.users-panel {
  overflow: hidden;
}

.news-permissions-panel {
  margin-top: 18px;
  padding-bottom: 18px;
}

.system-settings-panel {
  max-width: 980px;
  overflow: hidden;
  margin-bottom: 18px;
}

.system-settings-form {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.settings-checkbox {
  align-self: end;
  min-height: 54px;
}

.settings-meta {
  display: grid;
  gap: 4px;
  color: var(--black-01);
  font-size: 13px;
}

.smtp-test-field {
  min-width: min(280px, 100%);
}

.smtp-test-field input {
  margin-top: 6px;
}

.user-list {
  display: grid;
}

.user-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.user-row:hover,
.user-row:focus-visible {
  background: #f6f6f6;
  box-shadow: inset 5px 0 0 var(--black-03);
}

.user-row-main,
.user-row-meta {
  display: grid;
  gap: 5px;
}

.user-row-main strong {
  font-weight: 800;
}

.user-row-main span,
.user-row-meta span:not(.status) {
  color: var(--black-01);
  font-size: 13px;
}

.user-row-meta {
  justify-items: end;
  min-width: 150px;
}

.user-permissions-editor {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8f8f8;
}

.user-permissions-editor h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 400;
}

.user-permissions-grid {
  display: grid;
  gap: 12px;
}

.user-permission-group {
  display: grid;
  grid-template-columns: minmax(160px, 0.35fr) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.user-permission-group > div:first-child {
  display: grid;
  align-content: start;
  gap: 4px;
}

.user-permission-group strong {
  font-weight: 800;
}

.user-permission-group span {
  color: var(--black-01);
  font-size: 13px;
}

.user-permission-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px 12px;
}

.news-visibility-grid {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.news-visibility-role {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.news-visibility-role > div:first-child {
  display: grid;
  align-content: start;
  gap: 8px;
}

.news-visibility-role strong {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
}

.news-visibility-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.record-meta,
.reservation-line,
.agenda-meta,
.muted {
  color: var(--black-01);
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  min-height: 25px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #efefef;
  color: var(--black-02);
}

.status.planned {
  background: #e8edf5;
  color: #3c4b63;
}

.status.preparation {
  background: #dbeafe;
  color: #1d4ed8;
}

.status.completed {
  background: #dcfce7;
  color: #166534;
}

.status.cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.status.kp-valid {
  background: #dcefe3;
  color: #1d5a34;
}

.status.kp-expired,
.status.kp-error,
.status.kp-review-problem {
  background: #f4d9d5;
  color: #8b251d;
}

.status.kp-to_review,
.status.kp-review-pending {
  background: #f4ead0;
  color: #765514;
}

.status.kp-review-verified {
  background: #e5e5e5;
  color: var(--black-03);
}

.kp-layout {
  grid-template-columns: minmax(330px, 0.34fr) minmax(0, 1fr);
}

.kp-toolbar {
  grid-template-columns: repeat(8, minmax(140px, 1fr));
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 70px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.kp-record-flags {
  color: var(--black-01);
  font-size: 12px;
  line-height: 1.4;
}

.kp-detail {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.kp-detail-header,
.kp-status-stack {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.kp-detail-header h2 {
  margin: 4px 0 10px;
  font-size: 26px;
}

.kp-status-stack {
  align-items: flex-end;
  flex-direction: column;
}

.kp-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kp-flag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f4d9d5;
  color: #8b251d;
  font-size: 12px;
  font-weight: 800;
}

.kp-flag.ok {
  background: #dcefe3;
  color: #1d5a34;
}

.kp-detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.42fr) minmax(360px, 1fr);
  gap: 18px;
  align-items: start;
}

.kp-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.kp-form .full-row {
  grid-column: 1 / -1;
}

.kp-scan-panel,
.kp-candidate-panel,
.kp-raw-panel,
.kp-related-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.kp-scan-image {
  display: block;
  width: 100%;
  max-height: 720px;
  object-fit: contain;
  object-position: top center;
  background: #ededed;
}

.kp-generator-shell {
  display: grid;
  grid-template-columns: minmax(300px, 0.32fr) minmax(460px, 1fr) minmax(280px, 0.28fr);
  gap: 18px;
  align-items: start;
}

.kp-generator-legacy-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.kp-generator-legacy-panel summary {
  cursor: pointer;
  padding: 14px 18px;
  color: var(--black-02);
  font-weight: 700;
}

.kp-generator-legacy-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 170px);
  min-height: 760px;
  border: 0;
  background: #d9d9d9;
}

#kpGeneratorView > .module-header {
  display: flex;
}

.kp-generator-backup-shell[hidden] {
  display: none !important;
}

.kp-generator-form-panel,
.kp-generator-context-panel {
  position: sticky;
  top: 18px;
}

.kp-generator-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.kp-generator-form .full-row {
  grid-column: 1 / -1;
}

.kp-generator-preview-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #d9d9d9;
  box-shadow: var(--shadow);
}

.kp-generator-preview-panel .panel-heading {
  margin-bottom: 16px;
}

.kp-generator-preview-document {
  display: grid;
  place-items: start center;
  overflow: auto;
  min-height: 720px;
  padding: 30px;
  background: linear-gradient(90deg, #cfcfcf, #f5f5f5 12%, #f5f5f5 88%, #cfcfcf);
}

.kp-preview-page {
  width: min(100%, 760px);
  min-height: 600px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 0;
  padding: 28px 28px 22px;
  border: 1px solid var(--black-02);
  background: var(--white);
  color: var(--black-03);
  box-shadow: 0 18px 46px rgba(29, 29, 29, 0.18);
}

.kp-preview-page header {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) minmax(150px, 0.45fr);
  gap: 24px;
  align-items: start;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.kp-preview-page img {
  width: 170px;
  max-width: 100%;
}

.kp-preview-page span,
.kp-preview-page small {
  display: block;
  color: var(--black-01);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kp-preview-page strong {
  display: block;
  margin-top: 6px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.25;
}

.kp-preview-number {
  text-align: right;
}

.kp-preview-number strong {
  font-size: 22px;
}

.kp-preview-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
}

.kp-preview-deceased {
  font-size: 24px;
}

.kp-preview-table {
  display: grid;
  grid-template-columns: 0.9fr 1.3fr 1fr;
  border-bottom: 1px solid var(--black-02);
}

.kp-preview-table > * {
  min-height: 44px;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
}

.kp-preview-table > *:nth-child(3n) {
  border-right: 0;
}

.kp-preview-table div {
  background: var(--black-03);
  color: var(--white);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kp-preview-page footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}

.kp-preview-page footer > div {
  padding: 14px 0 0;
}

.kp-preview-page footer > div:last-child {
  text-align: right;
}

.kp-generator-context-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.kp-generator-draft-list {
  display: grid;
  gap: 10px;
}

.kp-generator-draft {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--black-03);
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease;
}

.kp-generator-draft:hover {
  border-color: var(--black-03);
  transform: translateY(-1px);
}

.kp-generator-draft span,
.kp-generator-draft small,
.kp-generator-draft em {
  display: block;
}

.kp-generator-draft small {
  margin-top: 6px;
  color: var(--black-01);
  font-size: 12px;
}

.kp-generator-draft em {
  flex: 0 0 auto;
  color: var(--black-01);
  font-size: 11px;
  font-style: normal;
  text-transform: uppercase;
}

.kp-candidate-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.kp-candidate-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 360px);
  gap: 14px;
  align-items: start;
}

.kp-candidate-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 14px 14px;
}

.kp-candidate {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  text-align: left;
}

.kp-candidate:hover,
.kp-candidate.is-selected {
  border-color: var(--black-03);
  box-shadow: inset 4px 0 0 var(--black-03);
}

.kp-candidate span,
.kp-candidate small {
  color: var(--black-01);
}

.kp-grave-preview {
  display: grid;
  margin: 14px 14px 14px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.kp-grave-preview.empty-state {
  min-height: 210px;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.kp-grave-preview-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #ededed;
}

.kp-grave-preview-thumb.is-empty {
  display: grid;
  place-items: center;
  color: var(--black-01);
}

.kp-grave-preview-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.kp-grave-preview-body h3,
.kp-grave-preview-body p {
  margin: 0;
}

.kp-grave-preview-details {
  display: grid;
  border-top: 1px solid var(--line);
}

.kp-grave-payments {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.kp-grave-payments h4,
.kp-grave-payments p {
  margin: 0;
}

.kp-grave-payment-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.kp-grave-payment-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.kp-grave-payment-card img,
.kp-grave-payment-scan-empty {
  width: 76px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  object-position: top center;
  background: #ededed;
}

.kp-grave-payment-scan-empty {
  display: grid;
  place-items: center;
  color: var(--black-01);
  font-size: 11px;
  text-align: center;
}

.kp-grave-payment-card div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.kp-grave-payment-card span {
  color: var(--black-01);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.kp-raw-panel textarea {
  width: 100%;
  min-height: 190px;
  border: 0;
  border-radius: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.kp-related-panel ul {
  margin: 0;
  padding: 14px 18px 18px 34px;
  color: var(--black-02);
  line-height: 1.6;
}

.grave-panel-layout {
  grid-template-columns: minmax(330px, 0.34fr) minmax(0, 1fr);
}

.tree-panel-layout {
  grid-template-columns: minmax(330px, 0.34fr) minmax(0, 1fr);
}

.grave-toolbar {
  grid-template-columns: minmax(260px, 2fr) minmax(160px, 0.5fr);
}

.tree-toolbar {
  grid-template-columns: minmax(260px, 2fr) minmax(150px, 0.45fr) minmax(210px, 0.7fr);
}

.inventory-map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.inventory-map-toolbar > label {
  min-width: 200px;
  flex: 1 1 220px;
}

.inventory-map-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
}

#inventoryMapMeasureToggle[hidden],
#inventoryPhotoPanel[hidden] {
  display: none;
}

.inventory-map-controls span,
.inventory-map-toolbar output {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--black-02);
  font-size: 13px;
}

.inventory-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.inventory-map-panel {
  position: relative;
  overflow: hidden;
}

#inventoryMapView.is-inventory-worker .inventory-map-toolbar {
  display: none !important;
}

#inventoryMapView.is-inventory-worker .inventory-map-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

#inventoryMapView.is-inventory-worker:not(.has-field-session) .inventory-map-layout {
  display: none;
}

#inventoryMapView.is-inventory-worker .inventory-map-panel {
  grid-row: 1;
}

#inventoryMapView.is-inventory-worker .inventory-register-toolbar,
#inventoryMapView.is-inventory-worker .inventory-register-footer {
  display: none;
}

#inventoryMapView.is-inventory-worker .inventory-position-register {
  grid-row: 2;
  position: static;
  max-height: none;
  overflow: visible;
}

#inventoryMapView.is-inventory-worker .inventory-poland-map {
  height: min(62vh, 680px);
  min-height: 460px;
}

.inventory-map-scope,
.inventory-map-basemap {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.inventory-map-scope .button,
.inventory-map-basemap .button {
  min-height: 36px;
  padding: 0 14px;
}

.inventory-map-basemap[hidden] {
  display: none;
}

.inventory-map-controls[hidden] {
  display: none;
}

.inventory-map-toolbar label[hidden] {
  display: none;
}

.inventory-poland-map {
  position: relative;
  height: min(72vh, 820px);
  min-height: 560px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #dfe3df;
}

.inventory-poland-map[hidden],
.inventory-map-canvas[hidden] {
  display: none;
}

.inventory-poland-map.leaflet-container {
  color: #1d1d1d;
  font-family: Arial, sans-serif;
}

.inventory-poland-map .leaflet-control-zoom a {
  color: #1d1d1d;
}

.inventory-poland-map .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.9);
  color: #313131;
}

.inventory-map-marker-label {
  margin-left: 8px;
  border: 0;
  border-radius: 4px;
  background: rgba(24, 24, 24, 0.9);
  box-shadow: none;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.inventory-map-marker-label::before {
  display: none;
}

.inventory-map-canvas {
  position: relative;
  height: min(72vh, 820px);
  min-height: 560px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, rgba(29, 29, 29, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(29, 29, 29, 0.06) 1px, transparent 1px),
    #d8d8d8;
  background-size: 42px 42px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.inventory-map-canvas:active {
  cursor: grabbing;
}

.inventory-map-canvas.is-measuring {
  cursor: crosshair;
}

.inventory-map-canvas.is-measuring:active {
  cursor: crosshair;
}

.inventory-map-stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}

.inventory-map-street,
.inventory-map-raster,
.inventory-map-vector,
.inventory-map-overlay {
  position: absolute;
  inset: 0;
  display: block;
}

.inventory-map-street {
  overflow: hidden;
  background: #e7e8e5;
}

.inventory-map-street img {
  position: absolute;
  display: block;
  user-select: none;
  pointer-events: none;
}

.inventory-map-raster {
  overflow: hidden;
  pointer-events: none;
}

.inventory-map-raster img {
  position: absolute;
  display: block;
  opacity: 0.82;
  mix-blend-mode: multiply;
  user-select: none;
  pointer-events: none;
}

.inventory-map-vector {
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 12px 40px rgba(29, 29, 29, 0.22);
}

.inventory-map-canvas.has-street-map .inventory-map-vector {
  background: transparent;
}

.inventory-map-canvas.has-street-map .inventory-map-vector svg {
  opacity: 0.16;
  mix-blend-mode: multiply;
}

.inventory-map-canvas.has-street-map .inventory-map-vector svg > rect:first-child {
  opacity: 0;
}

.inventory-map-vector svg {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  pointer-events: none;
}

.inventory-map-vector svg * {
  user-select: none;
  pointer-events: none;
}

.inventory-map-overlay {
  pointer-events: none;
}

.inventory-map-attribution {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 8;
  padding: 4px 7px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.88);
  color: #313131;
  font: 11px/1.2 Arial, sans-serif;
  text-decoration: none;
}

.inventory-map-side {
  overflow: hidden;
}

.dialog.inventory-position-dialog {
  width: min(1120px, calc(100% - 24px));
}

.inventory-position-dialog-shell {
  background: var(--white);
}

.inventory-position-dialog-header {
  align-items: center;
  margin: 0;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.inventory-position-dialog-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--black-01);
  font-size: 12px;
}

.inventory-position-dialog-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  max-height: calc(100vh - 150px);
  overflow: auto;
}

.inventory-position-dialog .inventory-position-form {
  align-content: start;
  padding: 20px 22px 24px;
  border: 0;
}

.inventory-position-workflow {
  min-width: 0;
  border-left: 1px solid var(--line);
  background: var(--paper);
}

.inventory-position-dialog .inventory-gps-panel,
.inventory-position-dialog .inventory-map-point-list,
.inventory-position-dialog .inventory-photo-panel {
  padding: 18px;
}

.inventory-map-live-status {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  display: inline-grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  max-width: min(330px, calc(100% - 24px));
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--white) 92%, transparent);
  color: var(--black-03);
  box-shadow: var(--soft-shadow);
  text-align: left;
  backdrop-filter: blur(12px);
}

.inventory-map-live-status:disabled {
  cursor: default;
  opacity: 0.78;
}

.inventory-map-live-status:not(:disabled):hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.inventory-map-live-status strong,
.inventory-map-live-status small {
  display: block;
}

.inventory-map-live-status strong {
  font-size: 12px;
}

.inventory-map-live-status small {
  margin-top: 2px;
  color: var(--black-01);
  font-size: 10px;
}

.inventory-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8e8e93;
}

.inventory-map-live-status.is-online .inventory-live-dot {
  background: #24a667;
  box-shadow: 0 0 0 4px rgba(36, 166, 103, 0.14);
  animation: inventory-live-dot 1.8s ease-in-out infinite;
}

.inventory-device-overview {
  position: absolute;
  right: 12px;
  bottom: 28px;
  z-index: 1000;
  width: min(280px, calc(100% - 24px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--white) 94%, transparent);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(14px);
}

.inventory-device-overview[hidden] {
  display: none;
}

.inventory-device-overview-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
}

.inventory-device-overview-heading span,
.inventory-device-overview-heading strong {
  display: block;
}

.inventory-device-overview-heading div > span {
  margin-bottom: 2px;
  color: var(--black-01);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.inventory-device-overview-heading strong {
  font-size: 13px;
}

.inventory-device-overview-heading > span {
  color: var(--black-01);
  font-size: 10px;
  font-weight: 700;
}

.inventory-device-overview-list {
  display: grid;
  max-height: 210px;
  overflow: auto;
}

.inventory-device-overview.is-collapsed .inventory-device-overview-list {display:none}
.inventory-device-overview.is-collapsed .inventory-device-overview-heading {border-bottom:0}
.inventory-device-overview-toggle {width:32px;height:32px;flex:0 0 32px}
.inventory-device-toggle-glyph {display:block;font-size:25px;line-height:1;transition:transform .18s ease}
.inventory-device-overview:not(.is-collapsed) .inventory-device-toggle-glyph {transform:rotate(90deg)}
.inventory-device-overview-entry {display:grid;grid-template-columns:minmax(0,1fr) 42px;border-bottom:1px solid var(--line)}
.inventory-device-overview-entry .inventory-device-overview-row {border-bottom:0}
.inventory-device-navigate {align-self:center}

.support-quick-button {position:fixed;right:22px;bottom:22px;z-index:88;width:52px;height:52px;display:none;place-items:center;border:1px solid var(--line);border-radius:50%;background:var(--black-03);color:var(--white);box-shadow:var(--strong-shadow);cursor:pointer}
.support-quick-button svg {width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:2}
body.is-authenticated .support-quick-button {display:grid}
.support-team-directory {border-top:1px solid var(--line);padding-top:16px}
.support-team-directory h3 {margin:0 0 10px;font-size:16px}
.support-team-person {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}
.support-team-person strong,.support-team-person span {display:block}
.support-team-person span {margin-top:2px;color:var(--black-01);font-size:12px}
.support-team-actions {display:flex;gap:6px}.support-team-actions .button {min-height:36px;padding:7px 10px}
.inventory-navigation-dialog {width:min(620px,calc(100% - 24px))}
.inventory-navigation-content {display:grid;gap:16px}
.inventory-navigation-camera {position:relative;min-height:330px;display:grid;place-items:center;overflow:hidden;border:1px solid var(--line);border-radius:7px;background:#171717;color:#fff}
.inventory-navigation-camera video {position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.inventory-navigation-arrow {position:relative;z-index:1;font:700 112px/1 Arial;text-shadow:0 2px 12px #000;transition:transform .2s linear}
.inventory-navigation-camera strong {position:absolute;z-index:2;left:16px;bottom:16px;padding:8px 10px;background:#000a;border-radius:5px;font-size:20px}

@media(max-width:800px){
  .inventory-device-overview {bottom:12px;width:calc(100% - 24px)}
  .inventory-device-overview:not(.is-collapsed) {max-height:min(54vh,430px)}
  .inventory-device-overview-list {max-height:min(42vh,330px)}
  .support-quick-button {right:14px;bottom:14px}
  .inventory-navigation-camera {min-height:52vh}
}

.inventory-device-overview-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 7px 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--black-03);
  text-align: left;
}

.inventory-device-overview-row:last-child {
  border-bottom: 0;
}

.inventory-device-overview-row:not(:disabled):hover {
  background: var(--light);
}

.inventory-device-overview-row:disabled {
  cursor: default;
}

.inventory-device-overview-row strong,
.inventory-device-overview-row small {
  display: block;
}

.inventory-device-overview-row strong {
  font-size: 12px;
}

.inventory-device-overview-row small {
  margin-top: 2px;
  color: var(--black-01);
  font-size: 10px;
}

.inventory-device-overview-row.is-online .inventory-live-dot {
  background: #168a54;
  box-shadow: 0 0 0 4px rgba(22, 138, 84, 0.16);
}

.inventory-device-overview-empty {
  padding: 14px;
  color: var(--black-01);
  font-size: 11px;
}

.inventory-live-marker text {
  fill: #10251b;
  stroke: #ffffff;
  stroke-width: 4px;
  paint-order: stroke;
  font: 700 12px Arial, sans-serif;
}

.inventory-live-marker-pulse {
  fill: rgba(36, 166, 103, 0.18);
  stroke: rgba(36, 166, 103, 0.4);
  stroke-width: 1px;
  animation: inventory-live-marker-pulse 1.8s ease-out infinite;
}

.inventory-live-marker-core {
  fill: #24a667;
  stroke: #ffffff;
  stroke-width: 2px;
}

@keyframes inventory-live-dot {
  50% { transform: scale(1.18); }
}

@keyframes inventory-live-marker-pulse {
  0% { opacity: 0.9; transform: scale(0.55); }
  75%, 100% { opacity: 0; transform: scale(1.25); }
}

.inventory-position-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.inventory-position-form label,
.inventory-photo-panel label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.inventory-position-form label > span,
.inventory-photo-panel label > span {
  color: var(--black-02);
  font-size: 12px;
  font-weight: 700;
}

.inventory-position-form input,
.inventory-position-form select,
.inventory-position-form textarea,
.inventory-photo-panel input {
  width: 100%;
  min-width: 0;
}

.inventory-field-wide {
  grid-column: 1 / -1;
}

.inventory-map-meta {
  display: grid;
  border-bottom: 1px solid var(--line);
}

.inventory-gps-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.inventory-gps-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.inventory-gps-head strong {
  display: block;
  font-size: 15px;
}

.inventory-gps-head span {
  display: block;
  margin-top: 2px;
  color: var(--black-03);
  font-size: 12px;
}

.inventory-gps-actions {
  display: inline-flex;
  gap: 8px;
}

.inventory-gps-actions .button {
  min-height: 36px;
  padding: 0 12px;
}

.inventory-gps-readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.inventory-gps-readout div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.inventory-gps-readout span {
  display: block;
  margin-bottom: 4px;
  color: var(--black-03);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inventory-gps-readout strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.inventory-gps-readout .is-good-fix {
  color: #167044;
}

.inventory-weak-fix {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--black-02);
  font-size: 12px;
}

.inventory-weak-fix input {
  width: 18px;
  height: 18px;
  margin: 0;
}

#inventoryGpsAddPoint:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.inventory-map-point-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.inventory-map-point {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.inventory-map-point strong {
  grid-column: 1 / -1;
}

.inventory-map-point span {
  color: var(--black-01);
  font-size: 12px;
}

.inventory-map-reference-point {
  border-color: rgba(181, 39, 39, 0.38);
  background: #fff7f7;
}

.inventory-map-reference-point strong {
  color: #8f1f1f;
}

.inventory-photo-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.inventory-photo-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.inventory-photo-card {
  display: grid;
  gap: 5px;
  color: inherit;
  text-decoration: none;
}

.inventory-photo-card img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.inventory-photo-card span {
  overflow: hidden;
  color: var(--black-02);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-position-register {
  margin-top: 18px;
  overflow: hidden;
}

.inventory-register-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.inventory-position-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 1px;
  background: var(--line);
}

.inventory-position-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  min-height: 118px;
  padding: 15px;
  border: 0;
  border-radius: 0;
  background: var(--white);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.inventory-position-row:hover,
.inventory-position-row.is-active {
  background: var(--paper);
}

.inventory-position-row strong,
.inventory-position-row small {
  grid-column: 1 / -1;
}

.inventory-position-row small {
  color: var(--black-03);
}

.inventory-position-row .status {
  align-self: end;
  justify-self: start;
}

.inventory-position-metric {
  align-self: end;
  color: var(--black-02);
  font-size: 12px;
  font-weight: 700;
}

/* Inventory field workspace */

.module-lead {
  margin: 6px 0 0;
  color: var(--black-01);
  font-size: 14px;
}

.inventory-field-session {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.inventory-field-session[hidden],
.inventory-session-controls[hidden],
.inventory-session-active[hidden] {
  display: none;
}

.inventory-field-session-heading,
.inventory-session-active,
.inventory-audit-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.inventory-field-session-heading h2,
.inventory-audit-heading h3 {
  margin: 2px 0 0;
  font-size: 20px;
}

.inventory-field-session-heading > span {
  color: var(--black-01);
  font-size: 12px;
  font-weight: 700;
}

.inventory-session-controls {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.inventory-session-controls label {
  display: grid;
  gap: 5px;
}

.inventory-session-controls label > span {
  color: var(--black-01);
  font-size: 11px;
  font-weight: 700;
}

.inventory-session-controls .button {
  min-height: 46px;
}

.inventory-session-active {
  justify-content: flex-start;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.inventory-session-active > div {
  display: grid;
  flex: 1 1 auto;
  gap: 3px;
}

.inventory-session-active > div span {
  color: var(--black-01);
  font-size: 11px;
}

.inventory-session-active .inventory-live-dot {
  background: var(--black-01);
}

.inventory-session-active.is-online .inventory-live-dot {
  background: #168a54;
  box-shadow: 0 0 0 5px rgba(22, 138, 84, 0.12);
}

.inventory-capture-mode {
  padding: 9px 10px;
  border-left: 3px solid var(--line-strong);
  background: var(--paper);
  color: var(--black-01);
  font-size: 11px;
  font-weight: 700;
}

.inventory-capture-mode.is-fixed {
  border-left-color: #168a54;
  color: #126c44;
}

.inventory-capture-mode.is-float {
  border-left-color: #b88216;
  color: #805b0f;
}

.inventory-audit-panel {
  border-top: 1px solid var(--line);
}

.inventory-audit-heading {
  padding: 14px;
}

.inventory-audit-heading > span {
  color: var(--black-01);
  font-size: 11px;
}

.inventory-audit-list {
  display: grid;
  max-height: 320px;
  overflow: auto;
}

.inventory-audit-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.inventory-audit-row[data-inventory-audit-position] {
  cursor: pointer;
}

.inventory-audit-row[data-inventory-audit-position]:hover {
  background: var(--paper);
}

.inventory-audit-row > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.inventory-audit-row small,
.inventory-audit-row time {
  color: var(--black-01);
  font-size: 10px;
}

.inventory-audit-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #168a54;
}

.inventory-map-technical,
.inventory-gps-technical {
  display: none !important;
}

.inventory-map-layout {
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
}

#inventoryMapView.is-active {
  animation-fill-mode: none;
}

.inventory-map-panel {
  min-width: 0;
}

.inventory-position-register {
  position: sticky;
  top: 88px;
  display: block;
  max-height: calc(100vh - 106px);
  margin-top: 0;
  overflow: auto;
}

.inventory-register-heading {
  align-items: center;
  padding: 16px;
}

.inventory-register-heading h2 {
  margin-top: 2px;
  font-size: 22px;
}

.inventory-register-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  padding: 0 14px 14px;
  border-bottom: 1px solid var(--line);
}

.inventory-register-toolbar label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.inventory-register-toolbar label > span {
  color: var(--black-01);
  font-size: 11px;
  font-weight: 700;
}

.inventory-register-toolbar select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
}

.inventory-register-scope {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.inventory-register-scope .button {
  min-height: 34px;
  padding: 0 10px;
}

.inventory-position-list {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overflow: visible;
  background: var(--paper);
}

.inventory-position-row {
  min-height: 108px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.inventory-position-row:hover,
.inventory-position-row.is-active {
  border-color: var(--line-strong);
  background: var(--white);
  transform: translateY(-1px);
}

.inventory-position-row.is-active {
  box-shadow: inset 3px 0 0 var(--black-03);
}

.inventory-position-sector {
  grid-column: 1 / -1;
  color: var(--black-03);
  font-size: 16px;
  font-weight: 800;
}

.inventory-position-row strong {
  font-size: 12px;
}

.inventory-position-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-register-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.inventory-register-footer .button {
  width: 100%;
}

.inventory-sector-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 0 14px 12px;
}

.inventory-sector-toolbar label,
.inventory-sector-form label {
  display: grid;
  gap: 5px;
}

.inventory-sector-toolbar label > span,
.inventory-sector-form label > span {
  color: var(--black-01);
  font-size: 11px;
  font-weight: 700;
}

.inventory-sector-toolbar .button {
  min-height: 42px;
}

.inventory-sector-form {
  display: grid;
  gap: 10px;
  margin: 0 14px 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.inventory-sector-form[hidden] {
  display: none;
}

.inventory-sector-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.inventory-sector-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  padding: 0 10px 10px;
  overflow: auto;
}

.inventory-sector-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--black-03);
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease;
}

.inventory-sector-item:hover,
.inventory-sector-item.is-active {
  border-color: var(--black-03);
  background: var(--light);
}

.inventory-sector-code {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 6px;
  background: var(--black-03);
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
}

.inventory-sector-copy {
  min-width: 0;
}

.inventory-sector-copy strong,
.inventory-sector-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-sector-copy small {
  margin-top: 3px;
  color: var(--black-01);
  font-size: 10px;
}

.inventory-sector-count {
  color: var(--black-01);
  font-size: 10px;
  font-weight: 700;
}

.inventory-selected-sector {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--light);
}

.inventory-selected-sector[hidden] {
  display: none;
}

.inventory-selected-sector span,
.inventory-selected-sector strong {
  display: block;
}

.inventory-selected-sector span {
  margin-bottom: 2px;
  color: var(--black-01);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.inventory-selected-sector strong {
  font-size: 13px;
}

.inventory-queue-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  padding: 13px 14px 10px;
}

.inventory-queue-heading h3 {
  margin: 2px 0 0;
  font-size: 17px;
}

.inventory-queue-heading > span {
  color: var(--black-01);
  font-size: 11px;
}

.inventory-editor-back {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--black-02);
  font-weight: 700;
}

#inventoryPositionEditorView.is-active {
  animation-fill-mode: none;
}

.inventory-position-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 460px);
  gap: 16px;
  align-items: start;
}

.inventory-position-editor-map-slot {
  position: sticky;
  top: 88px;
  min-width: 0;
}

.inventory-position-editor-map-slot .inventory-map-panel {
  width: 100%;
}

.inventory-position-editor-map-slot .inventory-poland-map,
.inventory-position-editor-map-slot .inventory-map-canvas {
  height: min(72vh, 760px);
  min-height: 520px;
}

.inventory-position-editor-card {
  min-width: 0;
  overflow: hidden;
}

.inventory-position-editor-card .inventory-position-dialog-shell {
  height: auto;
  overflow: visible;
}

.inventory-position-editor-card .inventory-position-dialog-header {
  position: static;
}

.inventory-position-editor-card .inventory-position-settings > summary {
  cursor: default;
}

.inventory-position-editor-card .inventory-finish-bar {
  position: sticky;
  bottom: 0;
}

.dialog.inventory-position-dialog {
  position: fixed;
  z-index: 1300;
  inset: 88px 18px 18px auto;
  width: min(460px, calc(100% - 36px));
  max-height: none;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
}

.dialog.inventory-position-dialog[open] {
  animation: inventory-drawer-in 220ms cubic-bezier(0.2, 0.85, 0.2, 1) both;
}

@keyframes inventory-drawer-in {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

.inventory-position-dialog-shell {
  height: 100%;
  overflow: auto;
  background: var(--white);
}

.inventory-position-dialog-header {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0;
  padding: 16px 18px;
  background: color-mix(in srgb, var(--white) 94%, transparent);
  backdrop-filter: blur(14px);
}

.inventory-position-dialog-header h2 {
  font-size: 25px;
}

.inventory-workflow-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.inventory-workflow-progress li {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--black-01);
  font-size: 11px;
  font-weight: 700;
}

.inventory-workflow-progress li:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 8px;
  width: 24px;
  height: 1px;
  background: var(--line-strong);
}

.inventory-workflow-progress li span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--white);
  font-size: 10px;
}

.inventory-workflow-progress li.is-active {
  color: var(--black-03);
}

.inventory-workflow-progress li.is-active span {
  border-color: var(--black-03);
  background: var(--black-03);
  color: var(--white);
}

.inventory-workflow-progress li.is-complete span {
  border-color: #20885a;
  background: #20885a;
  color: #fff;
}

.inventory-position-settings {
  border-bottom: 1px solid var(--line);
}

.inventory-position-settings > summary {
  padding: 13px 18px;
  color: var(--black-02);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.inventory-position-dialog .inventory-position-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px 18px 18px;
  border: 0;
}

.inventory-notes-field small {
  color: var(--black-01);
  font-weight: 400;
}

.inventory-position-workflow {
  border: 0;
  background: var(--white);
}

.inventory-position-workflow[hidden] {
  display: none;
}

.inventory-capture-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.inventory-capture-summary span,
.inventory-section-heading span {
  display: block;
  margin-bottom: 3px;
  color: var(--black-01);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.inventory-capture-summary strong {
  font-size: 15px;
}

.inventory-capture-summary .button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

.inventory-capture-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.inventory-position-dialog .inventory-gps-panel {
  gap: 12px;
  padding: 16px 18px;
  background: var(--white);
}

.inventory-gps-status-online {
  color: #20885a;
}

.inventory-gps-readout {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inventory-gps-readout div {
  padding: 9px;
}

.inventory-capture-button {
  min-height: 52px;
  font-size: 14px;
}

.inventory-position-dialog .inventory-map-point-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 12px 18px 16px;
  border-bottom: 1px solid var(--line);
}

.inventory-map-point {
  grid-template-columns: 1fr;
  gap: 7px;
  min-width: 0;
  padding: 10px;
}

.inventory-map-point-status,
.inventory-map-point-quality {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.inventory-map-point-status span:first-child {
  color: var(--black);
}

.inventory-map-point-coordinates {
  display: grid;
  gap: 4px;
  margin: 0;
}

.inventory-map-point-coordinates div {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 7px;
  align-items: baseline;
}

.inventory-map-point-coordinates dt {
  color: var(--black-01);
  font-size: 10px;
}

.inventory-map-point-coordinates dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--black);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.inventory-map-point-quality {
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.inventory-map-point-quality span {
  font-size: 10px;
}

.inventory-position-dialog .inventory-photo-panel {
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.inventory-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
}

.inventory-section-heading strong {
  font-size: 16px;
}

.inventory-section-heading small {
  max-width: 150px;
  color: var(--black-01);
  font-size: 10px;
  text-align: right;
}

.inventory-photo-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.inventory-photo-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 10px;
  cursor: pointer;
  text-align: center;
}

.inventory-photo-actions .button.is-uploading {
  opacity: 0.62;
  pointer-events: none;
}

.inventory-photo-panel input.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
}

.inventory-photo-optional {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid color-mix(in srgb, #b8831e 42%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, #f4c565 10%, var(--white));
  color: var(--black-02);
  font-size: 11px;
  font-weight: 700;
}

.inventory-photo-optional input {
  width: 17px;
  height: 17px;
  margin: 0;
}

.inventory-photo-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.inventory-finish-bar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: grid;
  gap: 9px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--white) 95%, transparent);
  backdrop-filter: blur(14px);
}

.inventory-finish-bar div {
  color: var(--black-01);
  font-size: 11px;
  text-align: center;
}

.inventory-finish-bar .button {
  min-height: 48px;
}

.inventory-finish-bar .button:disabled {
  opacity: 0.46;
}

.module-admin-panel {
  padding: 22px;
}

.module-admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.grave-record-list {
  max-height: 720px;
}

.tree-record-list {
  max-height: 720px;
}

.grave-panel-detail {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.tree-panel-detail {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.grave-panel-hero {
  display: grid;
  grid-template-columns: minmax(220px, 330px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.tree-panel-hero {
  display: grid;
  grid-template-columns: minmax(220px, 330px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.grave-panel-hero h2,
.grave-panel-hero p,
.tree-panel-hero h2,
.tree-panel-hero p {
  margin: 0;
}

.grave-panel-hero h2,
.tree-panel-hero h2 {
  margin: 4px 0 8px;
  font-size: 28px;
}

.grave-panel-thumb,
.tree-panel-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ededed;
}

.grave-panel-thumb.is-empty,
.tree-panel-thumb.is-empty {
  display: grid;
  place-items: center;
  color: var(--black-01);
  text-align: center;
}

.grave-panel-meta,
.tree-panel-meta {
  display: grid;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.grave-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.grave-panel-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.grave-photo-upload {
  display: grid;
  grid-template-columns: minmax(220px, 0.6fr) minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.grave-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  padding: 14px;
}

.grave-photo-card {
  display: grid;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.grave-photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ededed;
}

.grave-photo-card span {
  font-weight: 800;
}

.grave-photo-card small {
  color: var(--black-01);
}

.tree-note-form {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.tree-note-form .full-row {
  grid-column: auto;
}

.tree-photo-card {
  padding: 0;
  border: 0;
  background: transparent;
}

.tree-photo-card a {
  color: inherit;
  text-decoration: none;
}

.tree-photo-card .button {
  min-height: 36px;
  padding: 8px 10px;
}

.tree-report-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.tree-report-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.tree-report-card p {
  margin: 0;
  line-height: 1.5;
}

.tree-report-card span,
.tree-report-card small {
  color: var(--black-01);
}

.tree-description {
  max-width: 78ch;
  margin: 0;
  padding: 14px;
  line-height: 1.65;
}

.grave-kp-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 14px;
}

.details-panel {
  min-height: 620px;
}

.case-workspace {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: start;
}

.case-sections {
  display: grid;
  gap: 16px;
  align-content: start;
}

.case-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  font-family: var(--display);
  font-size: 24px;
}

.case-nav {
  display: grid;
  gap: 10px;
}

.case-nav button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-sm);
  background: #ececec;
  color: var(--black-03);
  text-align: left;
  padding: 10px 14px;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.case-nav button:hover {
  transform: translateX(2px);
  background: #e4e4e4;
}

.case-nav button.is-active {
  background: var(--black-03);
  color: var(--white);
}

.case-main {
  display: grid;
  gap: 22px;
}

.case-summary {
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.case-summary:hover {
  transform: translateY(-1px);
}

.case-summary-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--black-03);
  color: var(--white);
  border-bottom: 5px solid var(--black-01);
}

.case-summary-head h2 {
  margin: 0;
  font-size: 22px;
}

.case-summary-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.quick-status-control {
  min-width: 190px;
  color: var(--white);
}

.quick-status-control span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.quick-status-control select {
  min-height: 34px;
  padding: 6px 34px 6px 12px;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  box-shadow: none;
}

.quick-status-control option {
  color: var(--black-03);
}

.round-action {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  color: var(--white);
  background: transparent;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 18px 20px;
  padding: 22px 24px 28px;
}

.summary-item span,
.form-card label span,
.detail-row span:first-child {
  display: block;
  color: var(--black-01);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.summary-item strong {
  display: block;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.form-card {
  padding: 26px;
}

.form-card h3 {
  margin: 0 0 18px;
  font-size: 18px;
}

.case-section-card {
  animation: view-in 180ms ease both;
}

.status-workflow {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.workflow-step {
  min-height: 118px;
  display: grid;
  align-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--black-03);
  text-align: left;
  box-shadow: var(--soft-shadow);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.workflow-step:hover {
  border-color: var(--black-03);
  transform: translateY(-1px);
}

.workflow-step.is-current {
  background: var(--black-03);
  border-color: var(--black-03);
  color: var(--white);
}

.workflow-step span {
  font-weight: 800;
}

.workflow-step small {
  color: inherit;
  opacity: 0.72;
  line-height: 1.35;
}

.status-overview {
  display: grid;
  gap: 14px;
}

.status-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.status-current > span {
  color: var(--black-01);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 22px 28px;
}

.detail-row {
  min-height: 72px;
}

.detail-row strong {
  display: block;
  min-height: 46px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 5px 14px rgba(29, 29, 29, 0.06);
  background: var(--white);
}

.notes-block {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.case-aside {
  display: grid;
  gap: 18px;
}

.context-card {
  overflow: hidden;
}

.context-card h3 {
  padding: 18px 18px 10px;
}

.context-list {
  display: grid;
  gap: 8px;
  padding: 0 18px 18px;
}

.context-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--white);
  font-size: 13px;
}

.context-action {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-top: 1px solid var(--line);
  background: #f4f4f4;
  color: var(--black-02);
  font-weight: 800;
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--black-01);
  text-align: center;
}

.calendar-toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar-color-settings {
  margin: 14px 0 16px;
  padding: 13px 0 15px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.panel-subheading {
  margin-bottom: 10px;
  color: var(--black-01);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.parish-color-list {
  display: grid;
  gap: 8px;
}

.parish-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
  gap: 10px;
  min-height: 36px;
  color: var(--black-03);
  font-size: 13px;
}

.parish-color-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.parish-color-row i {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--parish-color);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.parish-color-row input {
  width: 42px;
  min-height: 30px;
  height: 30px;
  padding: 2px;
  box-shadow: none;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--soft-shadow);
}

.segment {
  border: 0;
  border-radius: 0;
}

.date-nav strong {
  min-width: 260px;
  text-align: center;
}

.calendar-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
}

.calendar-grid {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: visible;
  box-shadow: var(--shadow);
}

.calendar-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  position: relative;
  isolation: isolate;
}

.weekday {
  min-height: 38px;
  padding: 10px;
  background: var(--black-03);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.day-cell {
  position: relative;
  z-index: 1;
  min-height: 132px;
  height: 132px;
  padding: 8px 8px 34px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.day-cell:nth-child(7n) {
  border-right: 0;
}

.day-cell:hover,
.day-cell:focus-within,
.day-cell:focus-visible {
  background: #f9f9f9;
  box-shadow: inset 0 0 0 1px var(--black-03);
  outline: 0;
}

.day-cell.is-popover-open {
  z-index: 80;
  background: #f9f9f9;
  box-shadow: inset 0 0 0 1px var(--black-03);
  outline: 0;
}

.day-cell.is-muted {
  background: #f8f8f8;
  color: #999;
}

.day-cell.is-muted:hover,
.day-cell.is-muted:focus-within,
.day-cell.is-muted:focus-visible {
  background: #f3f3f3;
}

.day-cell.is-muted .event-chip {
  border-left-color: color-mix(in srgb, var(--event-color, var(--black-03)) 55%, #bdbdbd);
  background: #f1f1f1;
  color: #777;
  opacity: 0.72;
}

.day-cell.is-muted .event-chip:hover,
.day-cell.is-muted .event-chip:focus-visible {
  background: #f7f7f7;
  color: var(--black-03);
  opacity: 0.92;
}

.day-cell.is-today {
  box-shadow: inset 0 0 0 2px var(--black-03);
}

.day-number {
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 6px;
}

.day-events-compact {
  display: grid;
  gap: 4px;
  max-height: 58px;
  overflow: hidden;
  min-width: 0;
}

.day-events-compact .event-chip {
  min-height: 22px;
  max-width: 100%;
  padding: 3px 6px;
  font-size: 10px;
  margin-bottom: 0;
}

.event-overflow-indicator {
  position: absolute;
  z-index: 90;
  right: 7px;
  bottom: 7px;
  width: auto;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--black-03);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--soft-shadow);
}

.day-event-popover {
  position: absolute;
  left: 8px;
  top: 34px;
  z-index: 100;
  display: grid;
  gap: 6px;
  width: min(320px, calc(100vw - 32px));
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(252, 252, 252, 0.98);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.day-event-popover::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.day-cell:nth-child(7n) .day-event-popover,
.day-cell:nth-child(7n - 1) .day-event-popover {
  left: auto;
  right: 8px;
}

.day-event-popover > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.day-event-popover .event-chip {
  margin-bottom: 0;
}

.day-event-popover .event-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-cell.is-popover-open .day-event-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.event-chip {
  width: 100%;
  max-width: 100%;
  display: block;
  border: 0;
  border-left: 5px solid var(--event-color, var(--black-03));
  border-radius: 7px;
  background: #efefef;
  color: var(--black-03);
  padding: 6px 7px;
  margin-bottom: 5px;
  text-align: left;
  font-size: 12px;
  min-height: 36px;
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.event-chip.is-low-priority {
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--event-color, var(--black-03)) 12%, #ffffff),
      #f4f4f4);
  border-left-color: color-mix(in srgb, var(--event-color, var(--black-03)) 58%, #bdbdbd);
  color: var(--black-02);
  opacity: 0.82;
}

.event-chip.is-low-priority strong {
  font-weight: 700;
}

.event-chip.is-low-priority span {
  color: var(--black-01);
}

.event-chip:hover,
.event-chip:focus-visible {
  background: var(--white);
  box-shadow: 0 8px 18px rgba(29, 29, 29, 0.12);
  transform: translateY(-1px);
}

.event-chip.is-low-priority:hover,
.event-chip.is-low-priority:focus-visible {
  opacity: 1;
}

.event-chip strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-chip span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-list {
  display: grid;
}

.time-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.time-row:hover,
.time-row:focus-visible {
  background: #f8f8f8;
  box-shadow: inset 0 0 0 1px var(--black-03);
  outline: 0;
}

.time-label {
  padding: 11px;
  color: var(--black-01);
  background: #f7f7f7;
  border-right: 1px solid var(--line);
  font-weight: 700;
  font-size: 13px;
  transition: background 160ms ease, color 160ms ease;
}

.time-row:hover .time-label,
.time-row:focus-visible .time-label {
  background: var(--black-03);
  color: var(--white);
}

.time-events {
  padding: 8px;
  transition: background 160ms ease;
}

.time-row:hover .time-events,
.time-row:focus-visible .time-events {
  background: #fbfbfb;
}

.agenda-panel {
  padding: 16px;
}

.agenda-panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.agenda-panel-header h3 {
  margin: 0;
}

.compact-control {
  min-width: 132px;
}

.compact-control span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.compact-control select {
  min-height: 38px;
  padding: 8px 34px 8px 11px;
}

.agenda-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.agenda-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--event-color, var(--black-03));
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 11px;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.agenda-item:hover,
.agenda-item:focus-visible {
  border-color: var(--black-03);
  box-shadow: var(--soft-shadow);
  transform: translateY(-1px);
}

.agenda-title {
  margin: 0 0 5px;
  font-weight: 800;
}

.dialog {
  width: min(900px, calc(100% - 24px));
  max-height: calc(100% - 28px);
  border: 0;
  padding: 0;
}

.dialog[open] {
  animation: dialog-in 190ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.dialog::backdrop {
  background: rgba(29, 29, 29, 0.5);
}

.dialog form {
  padding: 22px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dialog h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
}

.event-info-dialog {
  width: min(680px, calc(100% - 24px));
}

.confirm-dialog {
  width: min(520px, calc(100% - 24px));
}

.event-info-content {
  padding: 22px;
}

.confirm-content {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.confirm-message {
  margin: 0;
  color: var(--black-02);
  line-height: 1.55;
}

.event-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.event-info-row {
  min-height: 76px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: 0 5px 14px rgba(29, 29, 29, 0.06);
}

.event-info-row span {
  display: block;
  margin-bottom: 7px;
  color: var(--black-01);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.event-info-row strong {
  display: block;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.calendar-event-preview {
  position: absolute;
  z-index: 50;
  width: min(318px, calc(100vw - 24px));
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.96);
  color: var(--black-03);
  box-shadow: 0 18px 42px rgba(29, 29, 29, 0.18);
  pointer-events: none;
  animation: preview-in 160ms ease both;
}

.calendar-event-preview strong {
  font-size: 14px;
}

.calendar-event-preview span {
  color: var(--black-01);
  font-size: 12px;
  line-height: 1.35;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.full-row {
  margin-top: 12px;
}

.fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 18px 0 0;
}

.fieldset legend {
  padding: 0 8px;
  font-weight: 800;
}

.errors {
  display: none;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #e3aaa5;
  background: #fff4f3;
  color: #8b251d;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.errors.is-visible {
  display: block;
}

.reset-result {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--black-02);
  font-size: 14px;
}

.reset-result:empty {
  display: none;
}

.reset-result a {
  overflow-wrap: anywhere;
  color: var(--black-03);
}

.activation-sms-section {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--light);
}

.activation-sms-section[hidden] {
  display: none;
}

#activationSmsCodeLabel[hidden] {
  display: none;
}

.activation-phone-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.activation-phone-row .button {
  min-width: 118px;
}

.activation-sms-hint,
.support-contact-lines {
  display: grid;
  gap: 5px;
  color: var(--black-01);
  font-size: 14px;
  line-height: 1.45;
}

.activation-sms-hint:empty {
  display: none;
}

.activation-sms-hint strong {
  color: var(--black-03);
}

.support-contact-lines a {
  width: fit-content;
  color: var(--black-03);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.support-contact-dialog {
  width: min(520px, calc(100% - 28px));
}

.support-contact-content {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.support-contact-content > p {
  margin: 0;
  color: var(--black-01);
  line-height: 1.55;
}

.support-message-form {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.support-message-heading {
  display: grid;
  gap: 3px;
}

.support-message-heading strong {
  color: var(--black-03);
  font-size: 15px;
}

.support-message-heading span {
  color: var(--black-01);
  font-size: 13px;
}

.support-message-form textarea {
  width: 100%;
  min-height: 108px;
  resize: vertical;
}

.support-message-form .dialog-actions {
  margin-top: 0;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  background: var(--black-03);
  color: var(--white);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1240px) {
  .topbar {
    grid-template-columns: 220px minmax(280px, 1fr);
  }

  .topbar-actions {
    grid-column: 2;
  }

  .case-workspace {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .kp-detail-grid {
    grid-template-columns: 1fr;
  }

  .kp-generator-shell {
    grid-template-columns: minmax(280px, 0.38fr) minmax(420px, 1fr);
  }

  .kp-generator-context-panel {
    grid-column: 1 / -1;
  }

  .kp-candidate-workspace {
    grid-template-columns: 1fr;
  }

  .grave-panel-hero,
  .tree-panel-hero,
  .grave-photo-upload {
    grid-template-columns: 1fr;
  }

  .kp-grave-preview {
    margin: 0 14px 14px;
  }

  .case-aside {
    grid-column: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.field-task-detail,
.chat-panel {
  display: grid;
  gap: 18px;
}

.field-task-record .status,
.conversation-record .status {
  min-width: 0;
}

.field-task-action-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--light);
}

.field-task-action-panel label,
.message-form,
.task-attachment-form {
  display: grid;
  gap: 8px;
}

.task-attachment-form {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: end;
}

.task-attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.task-attachment-card {
  display: grid;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.task-attachment-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.task-attachment-card span {
  font-weight: 700;
}

.task-attachment-card small {
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline h3 {
  margin: 0;
}

.timeline-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-left: 3px solid var(--black-03);
  background: var(--light);
}

.timeline-item span {
  color: var(--muted);
  font-size: 0.85rem;
}

.timeline-item p {
  margin: 0;
}

.messages-module-header {
  margin-bottom: 14px;
}

.messages-module-header .module-lead {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.messages-refresh {
  align-self: center;
}

.messages-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  height: min(720px, calc(100dvh - 196px));
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--soft-shadow);
}

.conversation-sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--light);
}

.conversation-sidebar-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 12px;
}

.conversation-sidebar-heading h2,
.conversation-sidebar-heading p {
  margin: 0;
}

.conversation-sidebar-heading h2 {
  margin-top: 3px;
  font-family: var(--display);
  font-size: 1.22rem;
}

.conversation-sidebar-heading > span {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.conversation-search {
  padding: 0 14px 12px;
}

.conversation-search input {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--white);
}

.conversation-list {
  min-height: 0;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.conversation-list .empty-state {
  padding: 26px 18px;
  border: 0;
  background: transparent;
}

.conversation-item {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 72px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.conversation-item:hover,
.conversation-item:focus-visible {
  background: var(--white);
}

.conversation-item.is-active {
  background: var(--white);
  box-shadow: inset 3px 0 0 var(--black-03);
}

.chat-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--black-02);
  font-size: 0.72rem;
  font-weight: 800;
}

.chat-avatar::after {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--line-strong);
  content: "";
}

.chat-avatar.is-online::after {
  background: #2f9e62;
}

.conversation-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.conversation-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.conversation-name-row strong,
.conversation-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-name-row strong {
  font-size: 0.88rem;
}

.conversation-name-row time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.69rem;
}

.conversation-preview {
  color: var(--muted);
  font-size: 0.78rem;
}

.conversation-preview.has-unread {
  color: var(--black-03);
  font-weight: 700;
}

.conversation-unread {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #b73a35;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
}

.chat-conversation {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-width: 0;
  min-height: 0;
  background: var(--white);
}

.chat-empty-state {
  grid-row: 1 / -1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.chat-empty-state strong {
  color: var(--black-02);
  font-family: var(--display);
  font-size: 1.15rem;
}

.chat-conversation-header {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 68px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.chat-conversation-header > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.chat-conversation-header strong,
.chat-conversation-header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation-header strong {
  font-size: 0.94rem;
}

.chat-conversation-header > div > span {
  color: var(--muted);
  font-size: 0.76rem;
}

.chat-back-button {
  display: none;
}

.chat-thread {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow-y: auto;
  padding: 20px clamp(14px, 3vw, 34px);
  background: var(--light);
  scrollbar-gutter: stable;
}

.chat-thread-empty {
  display: grid;
  place-self: center;
  justify-items: center;
  gap: 4px;
  color: var(--muted);
  text-align: center;
}

.chat-thread-empty strong {
  color: var(--black-02);
}

.chat-day-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 0.69rem;
}

.chat-day-divider::before,
.chat-day-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.message-bubble {
  display: grid;
  justify-self: start;
  gap: 5px;
  width: fit-content;
  max-width: min(70%, 620px);
  padding: 9px 12px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  animation: message-in 180ms ease-out both;
}

.message-bubble.is-mine {
  justify-self: end;
  border-color: var(--black-03);
  background: var(--black-03);
  color: var(--paper);
}

.message-bubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.42;
}

.message-bubble footer {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  color: inherit;
  font-size: 0.65rem;
  opacity: 0.64;
}

.message-context,
.message-context-preview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
}

.message-context {
  margin: 0 0 3px;
  padding: 3px 0 6px;
  border-bottom: 1px solid currentColor;
}

.message-context > span:nth-child(2),
.message-context-preview > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.message-context small,
.message-context strong,
.message-context-preview small,
.message-context-preview strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-context small,
.message-context-preview small {
  opacity: 0.68;
  font-size: 0.62rem;
  text-transform: uppercase;
}

.message-context-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 0.63rem;
  font-weight: 800;
}

.chat-typing-status {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 25px;
  padding: 2px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.7rem;
}

.chat-typing-status span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: chat-typing 900ms ease-in-out infinite;
}

.chat-typing-status span:nth-child(2) {
  animation-delay: 120ms;
}

.chat-typing-status span:nth-child(3) {
  animation-delay: 240ms;
}

.chat-typing-status strong {
  margin-left: 4px;
  font-weight: 500;
}

.message-form {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--white);
}

.message-composer-row {
  display: flex;
  align-items: end;
  gap: 8px;
}

.message-composer-row textarea {
  width: 100%;
  min-height: 42px;
  max-height: 128px;
  resize: none;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.35;
}

.message-send-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--black-03);
  border-radius: 50%;
  background: var(--black-03);
  color: var(--paper);
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 140ms ease, opacity 140ms ease;
}

.message-send-button:hover {
  transform: translateY(-1px);
}

.message-send-button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.message-context-preview {
  padding: 7px 9px;
  border-left: 3px solid var(--black-03);
  background: var(--light);
}

.message-context-preview button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.1rem;
}

@keyframes chat-typing {
  0%, 65%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  32% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 760px) {
  .messages-module-header {
    flex-direction: row;
    align-items: center;
  }

  .messages-module-header .module-lead {
    display: none;
  }

  .messages-workspace {
    grid-template-columns: 1fr;
    height: calc(100dvh - 154px);
    min-height: 480px;
  }

  .conversation-sidebar {
    border-right: 0;
  }

  .chat-conversation {
    display: none;
  }

  .messages-workspace.is-thread-open .conversation-sidebar {
    display: none;
  }

  .messages-workspace.is-thread-open .chat-conversation {
    display: grid;
  }

  .chat-back-button {
    display: grid;
  }

  .chat-conversation-header {
    padding-inline: 10px;
  }

  .message-bubble {
    max-width: 86%;
  }

  .chat-thread {
    padding: 14px 10px;
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .topbar,
  .module-header,
  .calendar-toolbar {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .toolbar,
  .split-layout,
  .calendar-shell,
  .case-workspace,
  .dashboard-overview,
  .dashboard-grid,
  .module-admin-grid,
  .kp-detail-grid,
  .kp-form,
  .kp-generator-shell,
  .kp-generator-form,
  .kp-preview-page header,
  .kp-preview-row,
  .kp-preview-page footer,
  .kp-toolbar,
  .tree-toolbar,
  .grave-toolbar,
  .inventory-map-toolbar,
  .inventory-map-layout,
  .tree-panel-layout,
  .grave-panel-layout,
  .field-task-layout,
  .messages-layout,
  .office-case-layout,
  .office-case-row,
  .grave-panel-hero,
  .tree-panel-hero,
  .grave-photo-upload,
  .tree-note-form,
  .task-attachment-form,
  .status-workflow,
  .summary-grid,
  .detail-grid,
  .user-permission-group,
  .user-permission-options,
  .news-visibility-role,
  .news-visibility-options {
    grid-template-columns: 1fr;
  }

  .dashboard-feature-panel {
    justify-self: stretch;
    width: 100%;
    margin-top: 0;
    max-width: none;
  }

  .dashboard-metric-row {
    transform: none;
  }

  .news-item {
    grid-template-columns: 1fr;
  }

  .case-avatar {
    margin: 0 0 12px;
  }

  .case-aside {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .agenda-panel {
    order: -1;
  }

  .inventory-map-canvas,
  .inventory-poland-map {
    height: 68vh;
    min-height: 440px;
  }

  .inventory-position-dialog-body {
    grid-template-columns: 1fr;
  }

  .inventory-position-workflow {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .kp-generator-form-panel,
  .kp-generator-context-panel {
    position: static;
  }

  .kp-generator-preview-document {
    min-height: 560px;
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 14px;
  }

  .topbar-actions,
  .dialog-actions,
  .date-nav {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-actions .button,
  .dialog-actions .button {
    flex: 1 1 140px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .dialog.inventory-position-dialog {
    width: calc(100% - 16px);
    max-height: calc(100% - 16px);
  }

  .inventory-position-dialog-header {
    padding: 16px;
  }

  .inventory-position-dialog-body {
    max-height: calc(100vh - 104px);
  }

  .inventory-position-dialog .inventory-position-form,
  .inventory-gps-readout {
    grid-template-columns: 1fr;
  }

  .inventory-position-dialog .inventory-position-form,
  .inventory-position-dialog .inventory-gps-panel,
  .inventory-position-dialog .inventory-map-point-list,
  .inventory-position-dialog .inventory-photo-panel {
    padding: 16px;
  }

  .inventory-field-wide {
    grid-column: auto;
  }

  .inventory-map-live-status {
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .event-info-grid {
    grid-template-columns: 1fr;
  }

  .date-nav strong {
    min-width: 100%;
    order: -1;
    text-align: left;
  }

  .kp-preview-table {
    grid-template-columns: 1fr;
  }

  .kp-preview-table > * {
    border-right: 0;
  }

  .kp-preview-number,
  .kp-preview-page footer > div:last-child {
    text-align: left;
  }

  .weekday {
    padding: 8px 4px;
    text-align: center;
  }

  .day-cell {
    min-height: 104px;
    height: 112px;
    padding: 6px 6px 28px;
  }

}

/* Theme controls and dark appearance */

.theme-toggle {
  width: 40px;
  height: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--black-03);
  box-shadow: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
  background: var(--light);
  transform: translateY(-1px);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--black-03);
  outline-offset: 3px;
}

.theme-toggle-icon {
  display: block;
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 18px;
  line-height: 1;
}

.login-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 5;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --white: #1c1c1e;
  --light: #242426;
  --paper: #111113;
  --line: #36363a;
  --line-strong: #505057;
  --black-01: #a8a8ad;
  --black-02: #dedee3;
  --black-03: #f5f5f7;
  --muted: var(--black-01);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  --soft-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] body {
  background: var(--paper);
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .module-strip,
html[data-theme="dark"] .dashboard-feature-panel,
html[data-theme="dark"] .login-card {
  background: rgba(28, 28, 30, 0.94);
}

html[data-theme="dark"] .activation-success-card {
  background: rgba(28, 28, 30, 0.96);
}

html[data-theme="dark"] .activation-success-icon {
  background: #173a24;
  color: #8de0a8;
}

html[data-theme="dark"] .topbar-icon-button {
  border-color: var(--line);
  background: #1c1c1e;
}

html[data-theme="dark"] .topbar-icon-button:hover,
html[data-theme="dark"] .activation-sms-section {
  background: #2c2c2e;
}

@media (max-width: 620px) {
  .activation-success-card {
    padding: 28px 22px;
  }

  .activation-success-card h1 {
    font-size: 32px;
  }

  .activation-phone-row {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .global-search input {
  color-scheme: dark;
  background: #2c2c2e;
  color: var(--black-03);
}

html[data-theme="dark"] .module-tab:hover,
html[data-theme="dark"] .record-item:hover,
html[data-theme="dark"] .global-search-result:hover,
html[data-theme="dark"] .button.secondary:hover,
html[data-theme="dark"] .theme-toggle:hover {
  background: #2c2c2e;
}

html[data-theme="dark"] .record-item.is-active {
  background: #303034;
  box-shadow: inset 4px 0 0 var(--black-03);
}

html[data-theme="dark"] .button.primary,
html[data-theme="dark"] .module-tab.is-active,
html[data-theme="dark"] .segment.is-active {
  border-color: #f5f5f7;
  background: #f5f5f7;
  color: #1d1d1f;
}

html[data-theme="dark"] .button.primary:hover {
  border-color: #ffffff;
  background: #ffffff;
}

html[data-theme="dark"] .feature-hero {
  background: #f5f5f7;
  color: #1d1d1f;
}

html[data-theme="dark"] .feature-hero .eyebrow,
html[data-theme="dark"] .feature-hero p {
  color: #5e5e63;
}

html[data-theme="dark"] .login-card .remember-card input:checked {
  border-color: #f5f5f7;
  background: #f5f5f7;
}

html[data-theme="dark"] .login-card .remember-card input:checked::before {
  border-color: #1d1d1f;
}

@media (max-width: 640px) {
  .topbar-actions {
    display: flex;
    align-items: center;
  }

  .topbar-actions #newFuneralButton {
    flex: 1 1 auto;
  }
}

@media (max-width: 900px) {
  #inventoryMapView .module-header {
    align-items: flex-start;
  }

  .inventory-device-overview {
    right: 8px;
    bottom: 24px;
    width: min(260px, calc(100% - 16px));
  }

  .inventory-device-overview-list {
    max-height: 144px;
  }

  .inventory-map-layout {
    grid-template-columns: 1fr;
  }

  .inventory-position-register {
    position: static;
    max-height: none;
  }

  .inventory-position-list {
    max-height: 420px;
  }

  .dialog.inventory-position-dialog {
    inset: auto 0 0 0;
    width: 100%;
    height: 62dvh;
    max-height: 62dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 10px 10px 0 0;
  }

  .dialog.inventory-position-dialog[open] {
    animation-name: inventory-sheet-in;
  }

  @keyframes inventory-sheet-in {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (max-width: 640px) {
  #inventoryMapView .module-header {
    gap: 12px;
    margin-bottom: 12px;
  }

  .inventory-field-session-heading,
  .inventory-session-active {
    align-items: stretch;
    flex-direction: column;
  }

  .inventory-session-controls {
    grid-template-columns: 1fr;
  }

  .inventory-session-active .button {
    width: 100%;
  }

  #inventoryMapView.is-inventory-worker .inventory-poland-map {
    height: 46dvh;
    min-height: 330px;
  }

  #inventoryMapView .module-header h1 {
    font-size: 30px;
  }

  #inventoryMapView .module-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }

  #inventoryMapView .module-actions .button {
    min-height: 44px;
  }

  .inventory-map-toolbar {
    gap: 7px;
    margin-bottom: 10px;
    padding: 8px;
  }

  .inventory-map-scope,
  .inventory-map-basemap {
    flex: 1 1 auto;
  }

  .inventory-map-scope .button,
  .inventory-map-basemap .button {
    flex: 1 1 auto;
    min-height: 34px;
    padding: 0 9px;
    font-size: 11px;
  }

  .inventory-map-toolbar > label {
    flex-basis: 100%;
    min-width: 0;
  }

  .inventory-map-canvas,
  .inventory-poland-map {
    height: 50dvh;
    min-height: 350px;
  }

  .inventory-map-live-status {
    right: auto;
    left: 8px;
    max-width: calc(100% - 64px);
    padding: 8px 10px;
  }

  .dialog.inventory-position-dialog {
    width: 100%;
    height: 64dvh;
    max-height: 64dvh;
  }

  .inventory-position-dialog-header {
    padding: 13px 14px;
  }

  .inventory-position-dialog-header h2 {
    font-size: 22px;
  }

  .inventory-workflow-progress {
    padding: 10px 14px;
  }

  .inventory-workflow-progress li {
    font-size: 10px;
  }

  .inventory-workflow-progress li:not(:last-child)::after {
    display: none;
  }

  .inventory-position-dialog .inventory-position-form {
    grid-template-columns: 1fr;
    padding: 4px 14px 14px;
  }

  .inventory-position-dialog .inventory-gps-panel,
  .inventory-position-dialog .inventory-map-point-list,
  .inventory-position-dialog .inventory-photo-panel {
    padding-right: 14px;
    padding-left: 14px;
  }

  .inventory-gps-readout {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .inventory-gps-readout div {
    padding: 7px;
  }

  .inventory-gps-readout strong {
    font-size: 11px;
  }

  .inventory-photo-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .inventory-register-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .inventory-position-editor-layout {
    grid-template-columns: 1fr;
  }

  .inventory-position-editor-map-slot {
    position: sticky;
    top: 58px;
    z-index: 5;
  }

  .inventory-position-editor-map-slot .inventory-poland-map,
  .inventory-position-editor-map-slot .inventory-map-canvas {
    height: 46dvh;
    min-height: 340px;
  }

  .inventory-position-editor-card {
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .inventory-editor-header {
    margin-bottom: 12px;
  }

  .inventory-editor-back {
    min-height: 36px;
    margin-bottom: 8px;
  }

  .inventory-position-editor-layout {
    gap: 10px;
  }

  .inventory-position-editor-map-slot .inventory-poland-map,
  .inventory-position-editor-map-slot .inventory-map-canvas {
    height: 34dvh;
    min-height: 250px;
  }

  #inventoryPositionEditorView.is-inventory-worker .inventory-map-toolbar,
  #inventoryPositionEditorView.is-inventory-worker .inventory-device-overview,
  #inventoryPositionEditorView.is-inventory-worker .inventory-map-attribution,
  #inventoryPositionEditorView.is-inventory-worker .inventory-map-controls {
    display: none !important;
  }

  #inventoryPositionEditorView.is-inventory-worker .inventory-position-settings:not([open]) {
    display: none;
  }

  .inventory-capture-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .inventory-capture-summary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-photo-actions {
    grid-template-columns: 1fr;
  }

  .inventory-sector-toolbar {
    grid-template-columns: 1fr;
  }

  .inventory-sector-list {
    max-height: none;
  }

  .inventory-selected-sector {
    align-items: stretch;
    flex-direction: column;
  }

  .inventory-selected-sector .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

/* Compact application shell: the modules remain independent, but the frame is shared. */
:root {
  --white: #ffffff;
  --light: #fbfbfc;
  --paper: #f5f5f7;
  --line: #e4e4e7;
  --line-strong: #cfcfd4;
  --black-01: #6e6e73;
  --black-02: #3a3a3c;
  --black-03: #1d1d1f;
  --shadow: 0 8px 26px rgba(29, 29, 31, 0.07);
  --soft-shadow: 0 3px 12px rgba(29, 29, 31, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --display: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: var(--paper);
}

body,
button,
input,
select,
textarea {
  letter-spacing: 0 !important;
}

.app-shell {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 18px 24px 56px 274px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(200px, 720px) auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  margin: 0 0 18px;
  padding: 8px;
  border: 1px solid rgba(228, 228, 231, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--soft-shadow);
}

.brand-lockup {
  position: fixed;
  top: 24px;
  left: 36px;
  z-index: 55;
}

.brand-logo {
  width: 172px;
  max-height: 52px;
}

.global-search {
  grid-column: 1;
}

.global-search::before {
  content: "⌕";
  left: 15px;
  color: var(--black-01);
  font-size: 24px;
}

.global-search input {
  height: 46px;
  padding-left: 46px;
  border-color: transparent;
  background: #f2f2f4;
  box-shadow: none;
}

.topbar-actions {
  grid-column: 2;
  flex-wrap: nowrap;
}

.topbar-actions .button {
  white-space: nowrap;
}

.user-pill {
  max-width: 210px;
  min-height: 38px;
  border: 0;
  background: transparent;
}

.module-strip {
  position: fixed;
  inset: 92px auto 18px 18px;
  z-index: 50;
  width: 226px;
  max-width: none;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 18px;
  margin: 0;
  padding: 14px 10px;
  overflow-y: auto;
  border: 1px solid rgba(228, 228, 231, 0.92);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px) saturate(150%);
}

.module-group {
  display: grid;
  gap: 3px;
}

.module-group-admin {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.module-group-label {
  padding: 0 12px 5px;
  color: #8e8e93;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.module-tab {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: var(--black-02);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.module-tab:hover {
  border-color: transparent;
  background: #f0f0f2;
}

.module-tab.is-active {
  background: var(--black-03);
  color: var(--white);
}

.sidebar-toggle,
.sidebar-scrim {
  display: none;
}

.breadcrumbs {
  min-height: 22px;
  margin: 0 0 14px;
  font-size: 12px;
}

main {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
}

.module-header {
  min-height: 72px;
  margin-bottom: 20px;
}

.module-header h1 {
  font-size: clamp(30px, 3.2vw, 46px);
  font-weight: 650;
  line-height: 1.05;
}

.module-intro {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.eyebrow {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
}

.button,
.segment,
.icon-button {
  border-color: var(--line);
  box-shadow: none;
  font-weight: 600;
}

.button:hover,
.segment:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  background: #f4f4f6;
}

.button.primary:hover,
.segment.is-active:hover {
  border-color: var(--black-03);
  background: #303033;
}

input,
select,
textarea {
  box-shadow: none;
}

.dashboard-overview {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  gap: 22px;
}

.dashboard-main-column .module-header {
  margin-bottom: 20px;
}

.dashboard-mode-actions {
  flex-wrap: nowrap;
}

.dashboard-mode-actions .segment,
.dashboard-mode-actions .button {
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.dashboard-panel-stack {
  gap: 18px;
}

.dashboard-zone {
  gap: 12px;
}

.dashboard-zone-heading {
  align-items: center;
}

.dashboard-zone-heading h2 {
  font-size: 22px;
  font-weight: 650;
}

.dashboard-zone-heading .eyebrow {
  display: none;
}

.dashboard-grid,
.dashboard-grid-admin {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.dashboard-card {
  min-height: 116px;
  gap: 10px;
  padding: 16px;
  border-radius: 10px;
  box-shadow: var(--soft-shadow);
}

.dashboard-card:not(.dashboard-card-static):hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.dashboard-card-label {
  font-size: 10px;
  font-weight: 700;
}

.dashboard-card strong {
  font-family: var(--ui);
  font-size: 20px;
  font-weight: 650;
}

.dashboard-card small {
  font-size: 12px;
}

.is-dashboard-mode-hidden {
  display: none !important;
}

.dashboard-feature-panel {
  position: sticky;
  top: 94px;
  width: 100%;
  margin: 0;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px) saturate(140%);
}

.dashboard-feature-panel::before,
.feature-hero::after {
  display: none;
}

.feature-clock {
  padding: 16px;
}

.feature-clock strong {
  font-size: 34px;
}

.feature-hero {
  min-height: 160px;
  padding: 18px;
  border-radius: 10px;
  box-shadow: none;
}

.feature-hero-number strong {
  font-size: 58px;
}

.feature-metrics {
  max-height: 350px;
  overflow: auto;
}

.dashboard-metric-row {
  min-height: 64px;
}

.panel,
.case-card,
.case-summary,
.context-card,
.dialog {
  box-shadow: var(--soft-shadow);
}

@media (max-width: 1180px) {
  .dashboard-overview {
    grid-template-columns: 1fr;
  }

  .dashboard-feature-panel {
    position: static;
    display: grid;
    grid-template-columns: minmax(220px, 0.6fr) minmax(320px, 1fr);
  }

  .feature-panel-label {
    grid-column: 1 / -1;
  }

  .feature-metrics {
    grid-column: 2;
    grid-row: 2 / span 2;
  }
}

@media (max-width: 980px) {
  .app-shell {
    padding: 12px 14px 48px;
  }

  .topbar {
    top: 8px;
    grid-template-columns: 40px minmax(180px, 1fr) auto;
  }

  .sidebar-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--black-03);
    font-size: 20px;
  }

  .brand-lockup {
    display: none;
  }

  .global-search {
    grid-column: 2;
  }

  .topbar-actions {
    grid-column: 3;
  }

  .topbar-actions .user-pill,
  .topbar-actions #refreshButton {
    display: none;
  }

  .module-strip {
    inset: 10px auto 10px 10px;
    width: min(280px, calc(100vw - 40px));
    transform: translateX(calc(-100% - 24px));
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  body.is-sidebar-open .module-strip {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 45;
    border: 0;
    background: rgba(29, 29, 31, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.is-sidebar-open .sidebar-scrim {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .dashboard-grid,
  .dashboard-grid-admin {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: 100%;
    padding: 8px 10px 36px;
  }

  .topbar {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 6px;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .topbar-actions #logoutButton {
    min-width: 92px;
  }

  .dashboard-mode-actions {
    width: 100%;
    align-items: stretch;
  }

  .dashboard-mode-actions .segmented {
    flex: 1;
  }

  .dashboard-grid,
  .dashboard-grid-admin,
  .dashboard-feature-panel {
    grid-template-columns: 1fr;
  }

  .feature-metrics {
    grid-column: auto;
    grid-row: auto;
  }
}

/* Notification center */

.notification-center {
  position: relative;
  flex: 0 0 auto;
}

.notification-button {
  position: relative;
  width: 40px;
  height: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--black-03);
  box-shadow: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.notification-button:hover,
.notification-button.is-open {
  border-color: var(--line-strong);
  background: var(--light);
  transform: translateY(-1px);
}

.notification-button:focus-visible {
  outline: 2px solid var(--black-03);
  outline-offset: 3px;
}

.notification-bell-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-origin: 50% 12%;
}

.notification-button.has-notifications:not(.is-open) .notification-bell-icon {
  animation: notification-ring 4.8s ease-in-out infinite;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border: 2px solid var(--white);
  border-radius: 999px;
  background: #c93636;
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(160, 24, 24, 0.28);
  animation: notification-pulse 2.8s ease-in-out infinite;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 100;
  width: min(360px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 22px 60px rgba(29, 29, 31, 0.18);
  transform-origin: top right;
  animation: notification-panel-in 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.notification-panel[hidden] {
  display: none;
}

.notification-panel-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.notification-panel-header > div {
  display: grid;
  gap: 3px;
}

.notification-panel-header strong {
  font-size: 16px;
}

.notification-panel-header > span {
  color: var(--black-01);
  font-size: 11px;
  white-space: nowrap;
}

.notification-list {
  max-height: min(440px, calc(100vh - 150px));
  overflow-y: auto;
  padding: 6px;
}

.notification-item {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--black-03);
  text-align: left;
  transition: background 150ms ease, transform 150ms ease;
}

.notification-item:hover {
  background: var(--paper);
  transform: translateX(2px);
}

.notification-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6e6e73;
}

.notification-message .notification-item-dot {
  background: #3478d4;
}

.notification-calendar .notification-item-dot {
  background: #8b5cf6;
}

.notification-task .notification-item-dot {
  background: #d68c24;
}

.notification-warning .notification-item-dot {
  background: #c93636;
}

.notification-item-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.notification-item-copy strong {
  font-size: 13px;
}

.notification-item-copy small {
  color: var(--black-01);
  font-size: 11px;
  line-height: 1.4;
}

.notification-item-count {
  min-width: 28px;
  height: 25px;
  display: grid;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--black-02);
  font-size: 11px;
  font-weight: 750;
}

.notification-empty {
  min-height: 132px;
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 24px;
  color: var(--black-01);
  text-align: center;
}

.notification-empty strong {
  color: var(--black-03);
  font-size: 14px;
}

.notification-empty span {
  font-size: 12px;
}

html[data-theme="dark"] .notification-button,
html[data-theme="dark"] .notification-panel {
  border-color: var(--line);
  background: #1c1c1e;
}

html[data-theme="dark"] .notification-button:hover,
html[data-theme="dark"] .notification-button.is-open,
html[data-theme="dark"] .notification-item:hover {
  background: #2c2c2e;
}

html[data-theme="dark"] .notification-badge {
  border-color: #1c1c1e;
}

html[data-theme="dark"] .errors {
  border-color: #6f3836;
  background: #321f20;
  color: #ffb4ae;
}

html[data-theme="dark"] .errors a {
  color: #ffd2ce;
}

@keyframes notification-ring {
  0%, 76%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  79% {
    transform: translateY(-3px) rotate(0deg);
  }
  82% {
    transform: translateY(-3px) rotate(-12deg);
  }
  85% {
    transform: translateY(-3px) rotate(11deg);
  }
  88% {
    transform: translateY(-2px) rotate(-7deg);
  }
  91% {
    transform: translateY(0) rotate(0deg);
  }
}

@keyframes notification-pulse {
  0%, 72%, 100% {
    box-shadow: 0 2px 8px rgba(160, 24, 24, 0.28);
    transform: scale(1);
  }
  80% {
    box-shadow: 0 0 0 5px rgba(201, 54, 54, 0.12);
    transform: scale(1.06);
  }
}

@keyframes notification-panel-in {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .notification-center {
    position: static;
  }

  .notification-panel {
    position: fixed;
    top: 116px;
    right: 10px;
    left: 10px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .notification-button.has-notifications .notification-bell-icon,
  .notification-badge {
    animation: none;
  }
}

/* Final dark-mode overrides stay after the compact shell rules. */

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .module-strip,
html[data-theme="dark"] .dashboard-feature-panel,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .user-pill,
html[data-theme="dark"] .event-overflow-indicator,
html[data-theme="dark"] .calendar-event-preview {
  border-color: var(--line);
  background: rgba(28, 28, 30, 0.94);
}

html[data-theme="dark"] .login-logo,
html[data-theme="dark"] .app-boot-screen img,
html[data-theme="dark"] .brand-logo {
  filter: invert(1);
}

html[data-theme="dark"] .inventory-map-reference-point {
  border-color: rgba(255, 105, 97, 0.45);
  background: #321f20;
}

html[data-theme="dark"] .inventory-map-reference-point strong {
  color: #ff9a94;
}

html[data-theme="dark"] .status.planned {
  background: #293241;
  color: #c8d3e5;
}

html[data-theme="dark"] .status.preparation {
  background: #163a63;
  color: #9dc7ff;
}

html[data-theme="dark"] .status.completed {
  background: #173f2b;
  color: #86efac;
}

html[data-theme="dark"] .status.cancelled {
  background: #4a2323;
  color: #ffb4ae;
}

html[data-theme="dark"] .global-search-results,
html[data-theme="dark"] .day-event-popover {
  border-color: var(--line);
  background: rgba(28, 28, 30, 0.98);
}

html[data-theme="dark"] .global-search-result:focus-visible,
html[data-theme="dark"] .record-item:hover,
html[data-theme="dark"] .office-case-row:hover,
html[data-theme="dark"] .user-row:hover,
html[data-theme="dark"] .user-row:focus-visible,
html[data-theme="dark"] .icon-button:hover,
html[data-theme="dark"] .context-action:hover {
  background: #2c2c2e;
}

html[data-theme="dark"] .office-case-row.is-active,
html[data-theme="dark"] .user-permissions-editor,
html[data-theme="dark"] .context-action {
  border-color: var(--line);
  background: #242426;
}

html[data-theme="dark"] .button.danger {
  border-color: #75403e;
  background: #3b2525;
  color: #ffb4ae;
}

html[data-theme="dark"] .status,
html[data-theme="dark"] .status.kp-review-verified {
  background: #343438;
  color: #dedee3;
}

html[data-theme="dark"] .status.kp-valid,
html[data-theme="dark"] .kp-flag.ok {
  background: #173f2b;
  color: #86efac;
}

html[data-theme="dark"] .status.kp-review-problem,
html[data-theme="dark"] .kp-flag {
  background: #4a2323;
  color: #ffb4ae;
}

html[data-theme="dark"] .status.kp-review-pending {
  background: #4a371c;
  color: #ffd58a;
}

html[data-theme="dark"] .kp-scan-image,
html[data-theme="dark"] .kp-grave-preview-thumb,
html[data-theme="dark"] .kp-grave-payment-scan-empty,
html[data-theme="dark"] .tree-panel-thumb,
html[data-theme="dark"] .grave-photo-card img {
  background: #242426;
}

html[data-theme="dark"] .case-nav button {
  border-color: var(--line);
  background: #29292c;
  color: var(--black-02);
}

html[data-theme="dark"] .case-nav button:hover {
  background: #343438;
  color: var(--black-03);
}

html[data-theme="dark"] .case-nav button.is-active {
  background: var(--black-03);
  color: var(--white);
}

html[data-theme="dark"] .calendar-grid {
  border-color: var(--line);
  background: #1c1c1e;
}

html[data-theme="dark"] .weekday {
  border-color: var(--line);
  background: #29292c;
  color: #f5f5f7;
}

html[data-theme="dark"] .day-cell {
  border-color: var(--line);
  background: #1c1c1e;
  color: var(--black-03);
}

html[data-theme="dark"] .day-cell:hover,
html[data-theme="dark"] .day-cell:focus-within,
html[data-theme="dark"] .day-cell:focus-visible,
html[data-theme="dark"] .day-cell.is-popover-open {
  background: #28282b;
  box-shadow: inset 0 0 0 1px #8e8e93;
}

html[data-theme="dark"] .day-cell.is-muted {
  background: #151517;
  color: #77777d;
}

html[data-theme="dark"] .day-cell.is-muted:hover,
html[data-theme="dark"] .day-cell.is-muted:focus-within,
html[data-theme="dark"] .day-cell.is-muted:focus-visible {
  background: #202023;
}

html[data-theme="dark"] .event-chip {
  border-left-color: var(--event-color, #8e8e93);
  background: color-mix(in srgb, var(--event-color, #8e8e93) 22%, #29292c);
  color: #f5f5f7;
}

html[data-theme="dark"] .event-chip span {
  color: #c7c7cc;
}

html[data-theme="dark"] .event-chip.is-low-priority {
  border-left-color: color-mix(in srgb, var(--event-color, #8e8e93) 66%, #77777d);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--event-color, #8e8e93) 18%, #242426),
    #29292c
  );
  color: #dedee3;
  opacity: 0.92;
}

html[data-theme="dark"] .day-cell.is-muted .event-chip {
  border-left-color: color-mix(in srgb, var(--event-color, #8e8e93) 48%, #626267);
  background: #242426;
  color: #a8a8ad;
  opacity: 0.78;
}

html[data-theme="dark"] .event-chip:hover,
html[data-theme="dark"] .event-chip:focus-visible,
html[data-theme="dark"] .day-cell.is-muted .event-chip:hover,
html[data-theme="dark"] .day-cell.is-muted .event-chip:focus-visible {
  background: color-mix(in srgb, var(--event-color, #8e8e93) 30%, #343438);
  color: #ffffff;
  opacity: 1;
}

html[data-theme="dark"] .time-row:hover,
html[data-theme="dark"] .time-row:focus-visible,
html[data-theme="dark"] .time-row:hover .time-events,
html[data-theme="dark"] .time-row:focus-visible .time-events {
  background: #28282b;
}

html[data-theme="dark"] .time-label {
  background: #202023;
  color: var(--black-01);
}

html[data-theme="dark"] .time-row:hover .time-label,
html[data-theme="dark"] .time-row:focus-visible .time-label {
  background: #303034;
  color: var(--black-03);
}

html[data-theme="dark"] .kp-generator-preview-panel,
html[data-theme="dark"] .kp-generator-legacy-frame {
  border-color: var(--line);
  background: #242426;
}

html[data-theme="dark"] .kp-generator-preview-document {
  background: linear-gradient(90deg, #18181a, #29292c 12%, #29292c 88%, #18181a);
}

html[data-theme="dark"] .inventory-map-attribution {
  border: 1px solid var(--line);
  background: rgba(28, 28, 30, 0.9);
  color: var(--black-02);
}

/* Characteristic background from the original Memoria interface. */

body {
  background:
    radial-gradient(circle at 102% -12%, transparent 0 170px, rgba(29, 29, 31, 0.16) 171px, transparent 172px),
    radial-gradient(circle at -12% 24%, transparent 0 230px, rgba(29, 29, 31, 0.12) 231px, transparent 232px),
    var(--paper);
  background-attachment: fixed;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 102% -12%, transparent 0 170px, rgba(245, 245, 247, 0.12) 171px, transparent 172px),
    radial-gradient(circle at -12% 24%, transparent 0 230px, rgba(245, 245, 247, 0.08) 231px, transparent 232px),
    var(--paper);
  background-attachment: fixed;
}

@media (max-width: 640px) {
  .topbar-actions {
    display: flex;
    align-items: center;
  }

  .topbar-actions .theme-toggle {
    flex: 0 0 40px;
  }

  .topbar-actions #newFuneralButton {
    flex: 1 1 auto;
  }
}
