.sheet-work {
  height: calc(100dvh - 78px);
  min-height: 360px;
  display: flex;
  flex-direction: column;
}
.sheet-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--line);
  background: #fafbf5;
  padding: 8px 16px;
}
.sheet-bar select,
.sheet-inspect select {
  min-width: 0;
  max-width: 36%;
  padding: 8px;
  border: 1px solid #cbd3c6;
  border-radius: 6px;
  background: #fffefa;
}
.sheet-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
}
.sheet-board {
  min-width: 0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  background-color: #e9ede5;
  background-image: radial-gradient(#c6cec2 1px, transparent 1px);
  background-size: 17px 17px;
}
.sheet-paper {
  position: absolute;
  box-shadow: 0 2px 16px #283b3426;
  background: white;
}
.sheet-paper img,
.sheet-paper svg {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  display: block;
}
.sheet-paper img {
  pointer-events: none;
}
.sheet-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 9px;
  padding: 25px;
  text-align: center;
}
.sheet-empty .empty-icon {
  width: 55px;
  height: 55px;
  background: #f8faf2;
  border: 1px solid #cad4c4;
}
.sheet-empty h2 {
  font-size: 19px;
}
.sheet-empty p,
.sheet-hint {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.sheet-nav {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 1px;
  background: #fffef8;
  border: 1px solid #cbd3c6;
  border-radius: 7px;
  padding: 2px;
}
.sheet-nav .btn {
  font-size: 0;
  padding: 6px;
  min-height: 31px;
  min-width: 31px;
  gap: 0;
  border: none;
}
.sheet-nav output {
  font-size: 12px;
  min-width: 36px;
  text-align: center;
}
.sheet-inspect {
  background: var(--white);
  border-left: 1px solid var(--line);
  padding: 17px;
  overflow: auto;
}
.sheet-inspect h2 {
  font-size: 18px;
}
.sheet-inspect select {
  max-width: 100%;
}
.sheet-inspect hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}
.scale-state {
  font-size: 13px;
  color: #3d664d;
  font-weight: bold;
  margin: 9px 0;
}
.sheet-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sheet-buttons .btn {
  font-size: 12px;
  min-height: 36px;
  padding: 6px 9px;
}
.sheet-buttons .chosen {
  border-color: #658768;
  background: #e6eee2;
}
.sheet-hint {
  margin: 12px 0 7px;
}
.measurements {
  font-size: 13px;
  line-height: 1.7;
  list-style: none;
  padding: 0;
  margin: 12px 0;
}
.measurements li {
  border-top: 1px solid var(--line);
  padding: 5px 0;
}
.sheet-dialog fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
}
.sheet-dialog legend {
  font-size: 13px;
}
.sheet-dialog input[type='file'] {
  max-width: 100%;
}
.sd-error {
  color: #9b4229;
  font-size: 14px;
  margin-top: 8px;
}
@media (max-width: 800px) {
  .sheet-work {
    height: calc(100dvh - 62px);
  }
  .sheet-body {
    grid-template-columns: minmax(0, 1fr) 225px;
  }
  .sheet-inspect {
    padding: 10px;
  }
}
@media (max-width: 660px) {
  .sheet-work {
    min-height: 480px;
  }
  .sheet-work .editor-top .buttons .btn {
    padding: 6px;
    font-size: 12px;
  }
  .sheet-bar {
    padding: 6px;
    gap: 4px;
  }
  .sheet-bar .btn {
    font-size: 12px;
    padding: 6px;
    min-height: 34px;
  }
  .sheet-bar select {
    font-size: 12px;
    padding: 6px;
    max-width: 34%;
  }
  .sheet-body {
    display: flex;
    flex-direction: column;
  }
  .sheet-board {
    flex: 1;
    min-height: 170px;
  }
  .sheet-inspect {
    height: min(245px, 35dvh);
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .sheet-inspect h2 {
    font-size: 15px;
  }
  .sheet-inspect .field,
  .scale-state {
    margin: 4px 0;
  }
  .sheet-inspect .field {
    flex-direction: row;
    align-items: center;
  }
  .sheet-inspect .field select {
    min-height: 30px;
    padding-block: 2px;
  }
  .sheet-inspect hr {
    margin: 6px 0;
  }
  .sheet-inspect .sheet-buttons {
    margin: 4px 0;
  }
  .sheet-hint {
    margin: 5px 0;
  }
  .sheet-empty p {
    font-size: 12px;
  }
}
@media (max-height: 540px) and (orientation: landscape) {
  body:has(.sheet-work) #header {
    display: none;
  }
  .sheet-work {
    height: 100dvh;
    min-height: 290px;
  }
  .sheet-work .editor-top {
    min-height: 40px;
  }
  .sheet-bar {
    padding-block: 3px;
  }
}
